Browse Source
Merge pull request #10974 from AvaloniaUI/fixes/prevent-double-close
Make sure that HandleClosed is called only once
pull/10982/head
Nikita Tsukanov
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
2 additions and
3 deletions
-
src/Avalonia.Controls/Primitives/PopupRoot.cs
-
src/Avalonia.Controls/TopLevel.cs
-
src/Avalonia.X11/X11Window.cs
-
src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs
|
|
|
@ -90,7 +90,6 @@ namespace Avalonia.Controls.Primitives |
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
PlatformImpl?.Dispose(); |
|
|
|
HandleClosed(); |
|
|
|
} |
|
|
|
|
|
|
|
private void UpdatePosition() |
|
|
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.ComponentModel; |
|
|
|
using System.Diagnostics; |
|
|
|
using Avalonia.Reactive; |
|
|
|
using Avalonia.Controls.Metadata; |
|
|
|
using Avalonia.Controls.Platform; |
|
|
|
@ -531,6 +532,7 @@ namespace Avalonia.Controls |
|
|
|
// We need to wait for the renderer to complete any in-flight operations
|
|
|
|
Renderer.Dispose(); |
|
|
|
|
|
|
|
Debug.Assert(PlatformImpl != null); |
|
|
|
// The PlatformImpl is completely invalid at this point
|
|
|
|
PlatformImpl = null; |
|
|
|
|
|
|
|
|
|
|
|
@ -898,7 +898,6 @@ namespace Avalonia.X11 |
|
|
|
_platform.XI2?.OnWindowDestroyed(_handle); |
|
|
|
var handle = _handle; |
|
|
|
_handle = IntPtr.Zero; |
|
|
|
Closed?.Invoke(); |
|
|
|
_mouse.Dispose(); |
|
|
|
_touch.Dispose(); |
|
|
|
if (!fromDestroyNotification) |
|
|
|
|
|
|
|
@ -115,7 +115,6 @@ namespace Avalonia.Win32 |
|
|
|
_hwnd = IntPtr.Zero; |
|
|
|
//Remove root reference to this class, so unmanaged delegate can be collected
|
|
|
|
s_instances.Remove(this); |
|
|
|
Closed?.Invoke(); |
|
|
|
|
|
|
|
_mouseDevice.Dispose(); |
|
|
|
_touchDevice.Dispose(); |
|
|
|
|