Reviewed by Kevin Ollivier.
authorkevino@webkit.org <kevino@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Nov 2009 19:55:54 +0000 (19:55 +0000)
committerkevino@webkit.org <kevino@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Nov 2009 19:55:54 +0000 (19:55 +0000)
Fix an assert on shutdown when wxWebView has captured the mouse,
and make sure wxWebView's right click handling is only active when
the WebCore popup menu is used.

https://bugs.webkit.org/show_bug.cgi?id=31131

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

WebKit/wx/ChangeLog
WebKit/wx/WebView.cpp

index 27d5101..7202b7f 100644 (file)
@@ -1,3 +1,18 @@
+2009-11-04  Kevin Watters  <kevinwatters@gmail.com>
+
+        Reviewed by Kevin Ollivier.
+
+        Fix an assert on shutdown when wxWebView has captured the mouse,
+        and make sure wxWebView's right click handling is only active when 
+        the WebCore popup menu is used.
+        
+        https://bugs.webkit.org/show_bug.cgi?id=31131
+
+        * WebView.cpp:
+        (wxWebView::~wxWebView):
+        (wxWebView::OnContextMenuEvents):
+        (wxWebView::OnMenuSelectEvents):
+
 2009-11-04  Vadim Zeitlin  <vadim@wxwidgets.org>
 
         Reviewed by Eric Seidel.
index 1b27cde..a112c79 100644 (file)
@@ -257,7 +257,6 @@ BEGIN_EVENT_TABLE(wxWebView, wxWindow)
     EVT_SIZE(wxWebView::OnSize)
     EVT_MOUSE_EVENTS(wxWebView::OnMouseEvents)
     EVT_CONTEXT_MENU(wxWebView::OnContextMenuEvents)
-    EVT_MENU(wxID_ANY, wxWebView::OnMenuSelectEvents)
     EVT_KEY_DOWN(wxWebView::OnKeyEvents)
     EVT_KEY_UP(wxWebView::OnKeyEvents)
     EVT_CHAR(wxWebView::OnKeyEvents)
@@ -348,6 +347,9 @@ wxWebView::~wxWebView()
 {
     m_beingDestroyed = true;
     
+    while (HasCapture())
+        ReleaseMouse();
+    
     if (m_mainFrame && m_mainFrame->GetFrame())
         m_mainFrame->GetFrame()->loader()->detachFromParent();
     
@@ -646,6 +648,7 @@ void wxWebView::OnMouseEvents(wxMouseEvent& event)
 
 void wxWebView::OnContextMenuEvents(wxContextMenuEvent& event)
 {
+    Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(wxWebView::OnMenuSelectEvents), NULL, this);
     m_impl->page->contextMenuController()->clearContextMenu();
     wxPoint localEventPoint = ScreenToClient(event.GetPosition());
 
@@ -675,10 +678,18 @@ void wxWebView::OnContextMenuEvents(wxContextMenuEvent& event)
         return;
 
     PopupMenu(menuWx, localEventPoint);
+    
+    Disconnect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(wxWebView::OnMenuSelectEvents), NULL, this);
 }
 
 void wxWebView::OnMenuSelectEvents(wxCommandEvent& event)
 {
+    // we shouldn't hit this unless there's a context menu showing
+    WebCore::ContextMenu* coreMenu = m_impl->page->contextMenuController()->contextMenu();
+    ASSERT(coreMenu);
+    if (!coreMenu)
+        return;
+
     WebCore::ContextMenuItem* item = WebCore::ContextMenu::itemWithId (event.GetId());
     if (!item)
         return;