Fix crash when bringing up the context menu on maps.google.com.
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Jan 2008 10:18:31 +0000 (10:18 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Jan 2008 10:18:31 +0000 (10:18 +0000)
If the website provides its own context menu then we don't have a ContextMenu pointer.

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

WebKit/qt/Api/qwebpage.cpp
WebKit/qt/ChangeLog

index 4e346239ef273e9900ec316797ce9d70e2b9b2da..3e1311d4290e5a92aa33755e935c8e37760186ea 100644 (file)
@@ -372,6 +372,11 @@ void QWebPagePrivate::contextMenuEvent(QContextMenuEvent *ev)
     WebCore::Frame* focusedFrame = page->focusController()->focusedOrMainFrame();
     focusedFrame->eventHandler()->sendContextMenuEvent(PlatformMouseEvent(ev, 1));
     ContextMenu *menu = page->contextMenuController()->contextMenu();
+    // If the website defines its own handler then sendContextMenuEvent takes care of
+    // calling/showing it and the context menu pointer will be zero. This is the case
+    // on maps.google.com for example.
+    if (!menu)
+        return;
 
     QWebPageContext oldContext = currentContext;
     currentContext = QWebPageContext(menu->hitTestResult());
index 3d4662ec089b75b44b05e4b117d00cc65dc8e42c..d42160496c226c6438736eb5177a381ffce33ee3 100644 (file)
@@ -1,3 +1,15 @@
+2008-01-16  Simon Hausmann  <hausmann@webkit.org>
+
+        Reviewed by Holger.
+
+        Fix crash when bringing up the context menu on maps.google.com.
+        
+        If the website provides its own context menu then we don't have a ContextMenu pointer.
+        
+
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::contextMenuEvent):
+
 2008-01-16  Simon Hausmann  <hausmann@webkit.org>
 
         Reviewed by Holger.