瀏覽代碼

Fix locking for the entire RunIdle callback execution

tznind 2 年之前
父節點
當前提交
b87fd489a1
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      Terminal.Gui/Core/MainLoop.cs

+ 5 - 2
Terminal.Gui/Core/MainLoop.cs

@@ -306,9 +306,12 @@ namespace Terminal.Gui {
 
 
 			Driver.MainIteration ();
 			Driver.MainIteration ();
 
 
+			bool runIdle = false;
 			lock (idleHandlersLock) {
 			lock (idleHandlersLock) {
-				if (idleHandlers.Count > 0)
-					RunIdle ();
+				runIdle = idleHandlers.Count > 0;
+			}
+			if (runIdle) {
+				RunIdle ();
 			}
 			}
 		}
 		}