Title: [246782] branches/safari-607-branch/Tools
Revision
246782
Author
ryanhad...@apple.com
Date
2019-06-24 21:15:14 -0700 (Mon, 24 Jun 2019)

Log Message

Cherry-pick r245975. rdar://problem/52090309

    WebKitTestRunner sometimes freezes under -[NSWindow release]
    https://bugs.webkit.org/show_bug.cgi?id=198422

    Reviewed by Tim Horton.

    The window remains key until it's out of the allWindows vector, and AppKit is not
    happy about deallocating key windows. Fixed by updating allWindows in -close
    instead of -release.

    Added isMainFrame assertions in code that manipulates allWindows for a good measure.

    * WebKitTestRunner/mac/WebKitTestRunnerWindow.mm:
    (+[WebKitTestRunnerWindow _WTR_keyWindow]):
    (-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]):
    (-[WebKitTestRunnerWindow close]):
    (-[WebKitTestRunnerWindow dealloc]):

    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245975 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-607-branch/Tools/ChangeLog (246781 => 246782)


--- branches/safari-607-branch/Tools/ChangeLog	2019-06-25 04:06:51 UTC (rev 246781)
+++ branches/safari-607-branch/Tools/ChangeLog	2019-06-25 04:15:14 UTC (rev 246782)
@@ -1,3 +1,46 @@
+2019-06-24  Ryan Haddad  <ryanhad...@apple.com>
+
+        Cherry-pick r245975. rdar://problem/52090309
+
+    WebKitTestRunner sometimes freezes under -[NSWindow release]
+    https://bugs.webkit.org/show_bug.cgi?id=198422
+    
+    Reviewed by Tim Horton.
+    
+    The window remains key until it's out of the allWindows vector, and AppKit is not
+    happy about deallocating key windows. Fixed by updating allWindows in -close
+    instead of -release.
+    
+    Added isMainFrame assertions in code that manipulates allWindows for a good measure.
+    
+    * WebKitTestRunner/mac/WebKitTestRunnerWindow.mm:
+    (+[WebKitTestRunnerWindow _WTR_keyWindow]):
+    (-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]):
+    (-[WebKitTestRunnerWindow close]):
+    (-[WebKitTestRunnerWindow dealloc]):
+    
+    
+    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-05-31  Alexey Proskuryakov  <a...@apple.com>
+
+            WebKitTestRunner sometimes freezes under -[NSWindow release]
+            https://bugs.webkit.org/show_bug.cgi?id=198422
+
+            Reviewed by Tim Horton.
+
+            The window remains key until it's out of the allWindows vector, and AppKit is not
+            happy about deallocating key windows. Fixed by updating allWindows in -close
+            instead of -release.
+
+            Added isMainFrame assertions in code that manipulates allWindows for a good measure.
+
+            * WebKitTestRunner/mac/WebKitTestRunnerWindow.mm:
+            (+[WebKitTestRunnerWindow _WTR_keyWindow]):
+            (-[WebKitTestRunnerWindow initWithContentRect:styleMask:backing:defer:]):
+            (-[WebKitTestRunnerWindow close]):
+            (-[WebKitTestRunnerWindow dealloc]):
+
 2019-06-13  Kocsen Chung  <kocsen_ch...@apple.com>
 
         Apply patch. rdar://problem/51656608

Modified: branches/safari-607-branch/Tools/WebKitTestRunner/mac/WebKitTestRunnerWindow.mm (246781 => 246782)


--- branches/safari-607-branch/Tools/WebKitTestRunner/mac/WebKitTestRunnerWindow.mm	2019-06-25 04:06:51 UTC (rev 246781)
+++ branches/safari-607-branch/Tools/WebKitTestRunner/mac/WebKitTestRunnerWindow.mm	2019-06-25 04:15:14 UTC (rev 246782)
@@ -27,6 +27,7 @@
 #import "WebKitTestRunnerWindow.h"
 
 #import "PlatformWebView.h"
+#import <wtf/MainThread.h>
 #import <wtf/Vector.h>
 
 @implementation WebKitTestRunnerWindow
@@ -37,6 +38,7 @@
 
 + (WebKitTestRunnerWindow *)_WTR_keyWindow
 {
+    ASSERT(isMainThread());
     for (auto window : allWindows) {
         if ([window isKeyWindow])
             return window;
@@ -46,14 +48,24 @@
 
 - (instancetype)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
 {
+    ASSERT(isMainThread());
     allWindows.append(self);
     return [super initWithContentRect:contentRect styleMask:windowStyle backing:bufferingType defer:deferCreation];
 }
 
-- (void)dealloc
+- (void)close
 {
+    ASSERT(isMainThread());
+    ASSERT(allWindows.contains(self));
     allWindows.removeFirst(self);
     ASSERT(!allWindows.contains(self));
+    [super close];
+}
+
+- (void)dealloc
+{
+    ASSERT(isMainThread());
+    ASSERT(!allWindows.contains(self)); // The window needs to stop being key before deallocation, otherwise AppKit spins waiting for this to happen (see <rdar://problem/50948871>).
     [super dealloc];
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to