소스 검색

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 ();
 
+			bool runIdle = false;
 			lock (idleHandlersLock) {
-				if (idleHandlers.Count > 0)
-					RunIdle ();
+				runIdle = idleHandlers.Count > 0;
+			}
+			if (runIdle) {
+				RunIdle ();
 			}
 		}