diff --git a/Terminal.Gui/Core/Application.cs b/Terminal.Gui/Core/Application.cs index 2632c69bef..eb1200999f 100644 --- a/Terminal.Gui/Core/Application.cs +++ b/Terminal.Gui/Core/Application.cs @@ -656,11 +656,8 @@ static void ProcessMouseEvent (MouseEvent me) lastMouseOwnerView?.OnMouseLeave (me); } // System.Diagnostics.Debug.WriteLine ($"{nme.Flags};{nme.X};{nme.Y};{mouseGrabView}"); - if (mouseGrabView != null) { - mouseGrabView.OnMouseEvent (nme); - if (mouseGrabView != null) { - return; - } + if (mouseGrabView != null && mouseGrabView.OnMouseEvent (nme)) { + return; } } diff --git a/UnitTests/ApplicationTests.cs b/UnitTests/ApplicationTests.cs index 1122bce239..8c335da05e 100644 --- a/UnitTests/ApplicationTests.cs +++ b/UnitTests/ApplicationTests.cs @@ -1301,7 +1301,7 @@ public void TestAddManyTimeouts () var myi = i; Task.Run (() => { - Task.Delay (100).Wait (); + Thread.Sleep (100); // each thread registers lots of 1s timeouts for (int j = 0; j < numberOfTimeoutsPerThread; j++) { @@ -1318,7 +1318,7 @@ public void TestAddManyTimeouts () if (myi == 0) { // let the timeouts run for a bit - Task.Delay (5000).Wait (); + Thread.Sleep (5000); // then tell the application to quit Application.MainLoop.Invoke (() => Application.RequestStop ());