Browse Source

Make sure that HandleClosed is called only once

pull/10974/head
Nikita Tsukanov 3 years ago
parent
commit
727e6ccdfd
  1. 1
      src/Avalonia.Controls/Primitives/PopupRoot.cs
  2. 2
      src/Avalonia.Controls/TopLevel.cs
  3. 1
      src/Avalonia.X11/X11Window.cs

1
src/Avalonia.Controls/Primitives/PopupRoot.cs

@ -90,7 +90,6 @@ namespace Avalonia.Controls.Primitives
public void Dispose() public void Dispose()
{ {
PlatformImpl?.Dispose(); PlatformImpl?.Dispose();
HandleClosed();
} }
private void UpdatePosition() private void UpdatePosition()

2
src/Avalonia.Controls/TopLevel.cs

@ -1,5 +1,6 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics;
using Avalonia.Reactive; using Avalonia.Reactive;
using Avalonia.Controls.Metadata; using Avalonia.Controls.Metadata;
using Avalonia.Controls.Platform; using Avalonia.Controls.Platform;
@ -531,6 +532,7 @@ namespace Avalonia.Controls
// We need to wait for the renderer to complete any in-flight operations // We need to wait for the renderer to complete any in-flight operations
Renderer.Dispose(); Renderer.Dispose();
Debug.Assert(PlatformImpl != null);
// The PlatformImpl is completely invalid at this point // The PlatformImpl is completely invalid at this point
PlatformImpl = null; PlatformImpl = null;

1
src/Avalonia.X11/X11Window.cs

@ -898,7 +898,6 @@ namespace Avalonia.X11
_platform.XI2?.OnWindowDestroyed(_handle); _platform.XI2?.OnWindowDestroyed(_handle);
var handle = _handle; var handle = _handle;
_handle = IntPtr.Zero; _handle = IntPtr.Zero;
Closed?.Invoke();
_mouse.Dispose(); _mouse.Dispose();
_touch.Dispose(); _touch.Dispose();
if (!fromDestroyNotification) if (!fromDestroyNotification)

Loading…
Cancel
Save