diff --git a/src/Perspex.Controls/Primitives/Popup.cs b/src/Perspex.Controls/Primitives/Popup.cs
index b0fbca931b..8cf0ef23e3 100644
--- a/src/Perspex.Controls/Primitives/Popup.cs
+++ b/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;
}
///
diff --git a/src/Perspex.Controls/Primitives/PopupRoot.cs b/src/Perspex.Controls/Primitives/PopupRoot.cs
index 9aca175028..a685f03071 100644
--- a/src/Perspex.Controls/Primitives/PopupRoot.cs
+++ b/src/Perspex.Controls/Primitives/PopupRoot.cs
@@ -15,7 +15,7 @@ namespace Perspex.Controls.Primitives
///
/// The root window of a .
///
- public class PopupRoot : TopLevel, IInteractive, IHostedVisualTreeRoot
+ public class PopupRoot : TopLevel, IInteractive, IHostedVisualTreeRoot, IDisposable
{
private IDisposable _presenterSubscription;
@@ -64,6 +64,12 @@ namespace Perspex.Controls.Primitives
///
IVisual IHostedVisualTreeRoot.Host => Parent;
+ ///
+ public void Dispose()
+ {
+ this.PlatformImpl.Dispose();
+ }
+
///
/// Hides the popup.
///