Title: [158156] branches/safari-537.73-branch/Source/WebKit2

Diff

Modified: branches/safari-537.73-branch/Source/WebKit2/ChangeLog (158155 => 158156)


--- branches/safari-537.73-branch/Source/WebKit2/ChangeLog	2013-10-29 02:07:53 UTC (rev 158155)
+++ branches/safari-537.73-branch/Source/WebKit2/ChangeLog	2013-10-29 02:10:47 UTC (rev 158156)
@@ -1,5 +1,29 @@
 2013-10-28  Lucas Forschler  <[email protected]>
 
+        Merge r156479
+
+    2013-09-25  Jer Noble  <[email protected]>
+
+            [WK2] Crash at at com.apple.WebKit2: WebKit::VoidCallback::invalidate + 46
+            https://bugs.webkit.org/show_bug.cgi?id=121910
+
+            Reviewed by Darin Adler.
+
+            Store a copy of the VoidCallback passed to WKPage, and invalidate the callback
+            during dealloc. The VoidCallback class assumes that it will only ever be
+            invalidated or invoked once, so change the ASSERTs into an early return.
+
+            * UIProcess/GenericCallback.h:
+            (WebKit::VoidCallback::performCallback): Exit early if previously invalidated.
+            (WebKit::VoidCallback::invalidate): Ditto.
+            * UIProcess/mac/WKFullScreenWindowController.h:
+            * UIProcess/mac/WKFullScreenWindowController.mm:
+            (-[WKFullScreenWindowController dealloc]): Invalidate the repaint callback if present.
+            (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Ditto & create a new callback.
+            (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): Clear the callback.
+
+2013-10-28  Lucas Forschler  <[email protected]>
+
         Merge r156302
 
     2013-09-23  Patrick Gansterer  <[email protected]>

Modified: branches/safari-537.73-branch/Source/WebKit2/UIProcess/GenericCallback.h (158155 => 158156)


--- branches/safari-537.73-branch/Source/WebKit2/UIProcess/GenericCallback.h	2013-10-29 02:07:53 UTC (rev 158155)
+++ branches/safari-537.73-branch/Source/WebKit2/UIProcess/GenericCallback.h	2013-10-29 02:10:47 UTC (rev 158156)
@@ -79,7 +79,8 @@
 
     void performCallback()
     {
-        ASSERT(m_callback);
+        if (!m_callback)
+            return;
 
         m_callback(0, context());
 
@@ -88,7 +89,8 @@
     
     void invalidate()
     {
-        ASSERT(m_callback);
+        if (!m_callback)
+            return;
 
         RefPtr<WebError> error = WebError::create();
         m_callback(toAPI(error.get()), context());

Modified: branches/safari-537.73-branch/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h (158155 => 158156)


--- branches/safari-537.73-branch/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h	2013-10-29 02:07:53 UTC (rev 158155)
+++ branches/safari-537.73-branch/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h	2013-10-29 02:10:47 UTC (rev 158156)
@@ -30,6 +30,7 @@
 
 namespace WebKit { 
 class LayerTreeContext;
+class VoidCallback;
 }
 
 namespace WebCore {
@@ -58,6 +59,7 @@
     FullScreenState _fullScreenState;
 
     double _savedScale;
+    RefPtr<WebKit::VoidCallback> _repaintCallback;
 }
 
 - (id)initWithWindow:(NSWindow *)window webView:(WKView *)webView;

Modified: branches/safari-537.73-branch/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (158155 => 158156)


--- branches/safari-537.73-branch/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2013-10-29 02:07:53 UTC (rev 158155)
+++ branches/safari-537.73-branch/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2013-10-29 02:10:47 UTC (rev 158156)
@@ -109,6 +109,14 @@
     [NSObject cancelPreviousPerformRequestsWithTarget:self];
     
     [[NSNotificationCenter defaultCenter] removeObserver:self];
+
+    if (_repaintCallback) {
+        _repaintCallback->invalidate();
+        // invalidate() calls completeFinishExitFullScreenAnimationAfterRepaint, which
+        // clears _repaintCallback.
+        ASSERT(!_repaintCallback);
+    }
+
     [super dealloc];
 }
 
@@ -398,11 +406,20 @@
     [self _manager]->setAnimatingFullScreen(false);
     [self _page]->scalePage(_savedScale, IntPoint());
     [self _manager]->restoreScrollPosition();
-    [self _page]->forceRepaint(VoidCallback::create(self, completeFinishExitFullScreenAnimationAfterRepaint));
+
+    if (_repaintCallback) {
+        _repaintCallback->invalidate();
+        // invalidate() calls completeFinishExitFullScreenAnimationAfterRepaint, which
+        // clears _repaintCallback.
+        ASSERT(!_repaintCallback);
+    }
+    _repaintCallback = VoidCallback::create(self, completeFinishExitFullScreenAnimationAfterRepaint);
+    [self _page]->forceRepaint(_repaintCallback);
 }
 
 - (void)completeFinishExitFullScreenAnimationAfterRepaint
 {
+    _repaintCallback = nullptr;
     [[_webView window] setAutodisplay:YES];
     [[_webView window] displayIfNeeded];
     NSEnableScreenUpdates();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to