Browse Source

Dispose of PopupRoot when detached from tree.

pull/467/head
Steven Kirk 10 years ago
parent
commit
fa7d810bbe
  1. 2
      src/Perspex.Controls/Primitives/Popup.cs
  2. 8
      src/Perspex.Controls/Primitives/PopupRoot.cs

2
src/Perspex.Controls/Primitives/Popup.cs

@ -231,6 +231,8 @@ namespace Perspex.Controls.Primitives
protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
{
_topLevel = null;
_popupRoot?.Dispose();
_popupRoot = null;
}
/// <summary>

8
src/Perspex.Controls/Primitives/PopupRoot.cs

@ -15,7 +15,7 @@ namespace Perspex.Controls.Primitives
/// <summary>
/// The root window of a <see cref="Popup"/>.
/// </summary>
public class PopupRoot : TopLevel, IInteractive, IHostedVisualTreeRoot
public class PopupRoot : TopLevel, IInteractive, IHostedVisualTreeRoot, IDisposable
{
private IDisposable _presenterSubscription;
@ -64,6 +64,12 @@ namespace Perspex.Controls.Primitives
/// </summary>
IVisual IHostedVisualTreeRoot.Host => Parent;
/// <inheritdoc/>
public void Dispose()
{
this.PlatformImpl.Dispose();
}
/// <summary>
/// Hides the popup.
/// </summary>

Loading…
Cancel
Save