Browse Source

Dispose the renderer before detaching visuals from the tree (perf)

See https://github.com/AvaloniaUI/Avalonia/issues/3622
pull/4191/head
Nikita Tsukanov 6 years ago
parent
commit
be73db7beb
  1. 6
      src/Avalonia.Controls/TopLevel.cs

6
src/Avalonia.Controls/TopLevel.cs

@ -340,6 +340,9 @@ namespace Avalonia.Controls
_globalStyles.GlobalStylesRemoved -= ((IStyleHost)this).StylesRemoved;
}
Renderer?.Dispose();
Renderer = null;
var logicalArgs = new LogicalTreeAttachmentEventArgs(this, this, null);
((ILogical)this).NotifyDetachedFromLogicalTree(logicalArgs);
@ -349,8 +352,7 @@ namespace Avalonia.Controls
(this as IInputRoot).MouseDevice?.TopLevelClosed(this);
PlatformImpl = null;
OnClosed(EventArgs.Empty);
Renderer?.Dispose();
Renderer = null;
LayoutManager?.Dispose();
}

Loading…
Cancel
Save