소스 검색

Move assertion outside the lock.

BDisp 1 년 전
부모
커밋
c5aeac060f
1개의 변경된 파일9개의 추가작업 그리고 5개의 파일을 삭제
  1. 9 5
      Terminal.Gui/Application.cs

+ 9 - 5
Terminal.Gui/Application.cs

@@ -417,15 +417,19 @@ public static partial class Application
             toplevel.EndInit ();
         }
 
+#if DEBUG_IDISPOSABLE
+        if (Top is { } && toplevel != Top && !_topLevels.Contains (Top))
+        {
+            // This assertion confirm if the Top was already disposed
+            Debug.Assert (Top.WasDisposed);
+            Debug.Assert (Top == _latestClosedRunStateToplevel);
+        }
+#endif
+
         lock (_topLevels)
         {
             if (Top is { } && toplevel != Top && !_topLevels.Contains (Top))
             {
-#if DEBUG_IDISPOSABLE
-                // This assertion confirm if the Top was already disposed
-                Debug.Assert (Top.WasDisposed);
-                Debug.Assert (Top == _latestClosedRunStateToplevel);
-#endif
                 // If Top was already disposed and isn't on the Toplevels Stack,
                 // clean it up here if is the same as _latestClosedRunStateToplevel
                 if (Top == _latestClosedRunStateToplevel)