Sfoglia il codice sorgente

Merge branch 'gui-cs:v2_develop' into v2_develop

Tig 1 mese fa
parent
commit
e3049bcb37

+ 11 - 0
Terminal.Gui/App/ApplicationImpl.cs

@@ -275,6 +275,8 @@ public class ApplicationImpl : IApplication
         if (Application.MainThreadId == Thread.CurrentThread.ManagedThreadId)
         {
             action ();
+            WakeupMainLoop ();
+
             return;
         }
 
@@ -293,6 +295,15 @@ public class ApplicationImpl : IApplication
                                return false;
                            }
                           );
+
+        WakeupMainLoop ();
+
+        void WakeupMainLoop ()
+        {
+            // Ensure the action is executed in the main loop
+            // Wakeup mainloop if it's waiting for events
+            Application.MainLoop?.Wakeup ();
+        }
     }
 
     /// <inheritdoc />

+ 1 - 1
Terminal.Gui/ViewBase/View.Drawing.cs

@@ -807,7 +807,7 @@ public partial class View // Drawing APIs
         }
 
         // There was multiple enumeration error here, so calling ToArray - probably a stop gap
-        foreach (View subview in SubViews.ToArray ())
+        foreach (View subview in InternalSubViews)
         {
             if (subview.Frame.IntersectsWith (viewPortRelativeRegion))
             {

+ 2 - 0
Tests/UnitTests/Views/SpinnerViewTests.cs

@@ -11,6 +11,8 @@ public class SpinnerViewTests (ITestOutputHelper output)
     [InlineData (false)]
     public void TestSpinnerView_AutoSpin (bool callStop)
     {
+        ConsoleDriver.RunningUnitTests = true;
+
         SpinnerView view = GetSpinnerView ();
 
         Assert.Empty (Application.MainLoop.TimedEvents.Timeouts);