Browse Source

Fix unit test error not disposing static variables.

BDisp 2 years ago
parent
commit
8715af2a42

+ 1 - 0
Terminal.Gui/Core/Application.cs

@@ -1134,6 +1134,7 @@ namespace Terminal.Gui {
 			_initialized = false;
 			_initialized = false;
 			mouseGrabView = null;
 			mouseGrabView = null;
 			_enableConsoleScrolling = false;
 			_enableConsoleScrolling = false;
+			lastMouseOwnerView = null;
 
 
 			// Reset synchronization context to allow the user to run async/await,
 			// Reset synchronization context to allow the user to run async/await,
 			// as the main loop has been ended, the synchronization context from 
 			// 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);
 			return MostFocused?.OnLeave (view) ?? base.OnLeave (view);
 		}
 		}
+
+		///<inheritdoc/>
+		protected override void Dispose (bool disposing)
+		{
+			dragPosition = null;
+			base.Dispose (disposing);
+		}
 	}
 	}
 
 
 	/// <summary>
 	/// <summary>

+ 2 - 0
UnitTests/TopLevels/ToplevelTests.cs

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