From 8715af2a42e9c4f74b6aec1a60498060aeac8dbf Mon Sep 17 00:00:00 2001 From: BDisp Date: Wed, 15 Mar 2023 21:30:24 +0000 Subject: [PATCH] Fix unit test error not disposing static variables. --- Terminal.Gui/Core/Application.cs | 1 + Terminal.Gui/Core/Toplevel.cs | 7 +++++++ UnitTests/TopLevels/ToplevelTests.cs | 2 ++ 3 files changed, 10 insertions(+) diff --git a/Terminal.Gui/Core/Application.cs b/Terminal.Gui/Core/Application.cs index e70570d9f..7784dd791 100644 --- a/Terminal.Gui/Core/Application.cs +++ b/Terminal.Gui/Core/Application.cs @@ -1134,6 +1134,7 @@ namespace Terminal.Gui { _initialized = false; mouseGrabView = null; _enableConsoleScrolling = false; + lastMouseOwnerView = null; // Reset synchronization context to allow the user to run async/await, // as the main loop has been ended, the synchronization context from diff --git a/Terminal.Gui/Core/Toplevel.cs b/Terminal.Gui/Core/Toplevel.cs index 08952f48b..23dc882ed 100644 --- a/Terminal.Gui/Core/Toplevel.cs +++ b/Terminal.Gui/Core/Toplevel.cs @@ -984,6 +984,13 @@ namespace Terminal.Gui { { return MostFocused?.OnLeave (view) ?? base.OnLeave (view); } + + /// + protected override void Dispose (bool disposing) + { + dragPosition = null; + base.Dispose (disposing); + } } /// diff --git a/UnitTests/TopLevels/ToplevelTests.cs b/UnitTests/TopLevels/ToplevelTests.cs index 3df27386b..6e1f2a877 100644 --- a/UnitTests/TopLevels/ToplevelTests.cs +++ b/UnitTests/TopLevels/ToplevelTests.cs @@ -1163,6 +1163,8 @@ namespace Terminal.Gui.TopLevelTests { │ this. │ │ │ └────────────────────────────┘", output); + + Application.End (rs); } } } \ No newline at end of file