浏览代码

Merge pull request #2083 from tznind/fix-deadlock

Fixes #2073. Fixes regression introduced in v1.8.2: Nesting `MainLoop.Invoke` deadlocks
Tig 2 年之前
父节点
当前提交
13572955f7
共有 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 ();
 
+			bool runIdle = false;
 			lock (idleHandlersLock) {
-				if (idleHandlers.Count > 0)
-					RunIdle ();
+				runIdle = idleHandlers.Count > 0;
+			}
+			if (runIdle) {
+				RunIdle ();
 			}
 		}