2011-04-20 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Apr 2011 23:41:52 +0000 (23:41 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Apr 2011 23:41:52 +0000 (23:41 +0000)
        Reviewed by Sam Weinig.

        Reproducible crash under WebPageProxy::didReceiveEvent
        https://bugs.webkit.org/show_bug.cgi?id=59036
        <rdar://problem/9252083>

        * UIProcess/API/mac/WKView.mm:
        (-[WKView _resendKeyDownEvent:]): Protect against self-destruction
        when re-dispatching the event.
        * UIProcess/WebProcessProxy.cpp:
        (WebKit::WebProcessProxy::createWebPage): Fixed a type mismatch
        I noticed while debugging.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/WebProcessProxy.cpp

index 5fc9eb2f3a4d8c63fc6d160e7568ba0f15430f66..ac7b95cc9b1f17c75135cb406f97188c98bae56b 100644 (file)
@@ -1,3 +1,18 @@
+2011-04-20  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Reproducible crash under WebPageProxy::didReceiveEvent
+        https://bugs.webkit.org/show_bug.cgi?id=59036
+        <rdar://problem/9252083>
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _resendKeyDownEvent:]): Protect against self-destruction
+        when re-dispatching the event.        
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::createWebPage): Fixed a type mismatch
+        I noticed while debugging.
+
 2011-04-20  Timothy Hatcher  <timothy@apple.com>
 
         Make the Web Insepctor come to the front when a breakpoint is hit.
 2011-04-20  Timothy Hatcher  <timothy@apple.com>
 
         Make the Web Insepctor come to the front when a breakpoint is hit.
index 80345f72cd9df6b6d3c58d59fa8f9228105b0f9e..9fa1f3d56153256b89053a68143ddea346b5b890 100644 (file)
@@ -1987,6 +1987,9 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
 
 - (void)_resendKeyDownEvent:(NSEvent *)event
 {
 
 - (void)_resendKeyDownEvent:(NSEvent *)event
 {
+    // resending the event may destroy this WKView
+    RetainPtr<WKView> protect(self);
+
     ASSERT(!_data->_keyDownEventBeingResent);
     _data->_keyDownEventBeingResent = event;
     [NSApp _setCurrentEvent:event];
     ASSERT(!_data->_keyDownEventBeingResent);
     _data->_keyDownEventBeingResent = event;
     [NSApp _setCurrentEvent:event];
index a8ae574a47e85fbb76cf3992316ad99a06859742..42cac88669162158daa83180f45c84f78a898005 100644 (file)
@@ -169,7 +169,7 @@ PassRefPtr<WebPageProxy> WebProcessProxy::createWebPage(PageClient* pageClient,
 {
     ASSERT(context->process() == this);
 
 {
     ASSERT(context->process() == this);
 
-    unsigned pageID = generatePageID();
+    uint64_t pageID = generatePageID();
     RefPtr<WebPageProxy> webPage = WebPageProxy::create(pageClient, this, pageGroup, pageID);
     m_pageMap.set(pageID, webPage.get());
     return webPage.release();
     RefPtr<WebPageProxy> webPage = WebPageProxy::create(pageClient, this, pageGroup, pageID);
     m_pageMap.set(pageID, webPage.get());
     return webPage.release();