瀏覽代碼

Fix unit test error not disposing static variables.

BDisp 2 年之前
父節點
當前提交
8715af2a42
共有 3 個文件被更改,包括 10 次插入0 次删除
  1. 1 0
      Terminal.Gui/Core/Application.cs
  2. 7 0
      Terminal.Gui/Core/Toplevel.cs
  3. 2 0
      UnitTests/TopLevels/ToplevelTests.cs

+ 1 - 0
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 

+ 7 - 0
Terminal.Gui/Core/Toplevel.cs

@@ -984,6 +984,13 @@ namespace Terminal.Gui {
 		{
 			return MostFocused?.OnLeave (view) ?? base.OnLeave (view);
 		}
+
+		///<inheritdoc/>
+		protected override void Dispose (bool disposing)
+		{
+			dragPosition = null;
+			base.Dispose (disposing);
+		}
 	}
 
 	/// <summary>

+ 2 - 0
UnitTests/TopLevels/ToplevelTests.cs

@@ -1163,6 +1163,8 @@ namespace Terminal.Gui.TopLevelTests {
                     │           this.            │
                     │                            │
                     └────────────────────────────┘", output);
+
+			Application.End (rs);
 		}
 	}
 }