Title: [156479] trunk/Source/WebKit2
- Revision
- 156479
- Author
- [email protected]
- Date
- 2013-09-26 11:13:19 -0700 (Thu, 26 Sep 2013)
Log Message
[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.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (156478 => 156479)
--- trunk/Source/WebKit2/ChangeLog 2013-09-26 18:13:00 UTC (rev 156478)
+++ trunk/Source/WebKit2/ChangeLog 2013-09-26 18:13:19 UTC (rev 156479)
@@ -1,3 +1,23 @@
+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-09-26 Tim Horton <[email protected]>
Tiled drawing should not imply threaded scrolling
Modified: trunk/Source/WebKit2/UIProcess/GenericCallback.h (156478 => 156479)
--- trunk/Source/WebKit2/UIProcess/GenericCallback.h 2013-09-26 18:13:00 UTC (rev 156478)
+++ trunk/Source/WebKit2/UIProcess/GenericCallback.h 2013-09-26 18:13:19 UTC (rev 156479)
@@ -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: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h (156478 => 156479)
--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h 2013-09-26 18:13:00 UTC (rev 156478)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h 2013-09-26 18:13:19 UTC (rev 156479)
@@ -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: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (156478 => 156479)
--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm 2013-09-26 18:13:00 UTC (rev 156478)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm 2013-09-26 18:13:19 UTC (rev 156479)
@@ -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