From 18b2decc850ccd71fd29143657073f89c752578f Mon Sep 17 00:00:00 2001 From: BDisp Date: Thu, 15 Sep 2022 18:01:17 +0100 Subject: [PATCH 1/2] Fixes #2014. Application mouseGrabView is run twice if return true. --- Terminal.Gui/Core/Application.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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; } } From e3d79b1648660c03b1fe4a4c5e6f70277960512b Mon Sep 17 00:00:00 2001 From: BDisp Date: Thu, 15 Sep 2022 19:41:23 +0100 Subject: [PATCH 2/2] Sometimes I get fails with this unit test. --- UnitTests/ApplicationTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 ());