]> git.saurik.com Git - wxWidgets.git/commitdiff
Use the correct event handler in wxMenuBase::UpdateUI().
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 10 Jul 2011 12:55:30 +0000 (12:55 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 10 Jul 2011 12:55:30 +0000 (12:55 +0000)
Use GetWindow() instead of GetInvokingWindow() to send the event to the
associated window for the menus that are part of the menu bar and not only the
popup ones. This was broken since r64127 because GetInvokingWindow() is now
only used for the popup menus.

Closes #13317.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/menucmn.cpp

index 32f525d6738544b0d3d6ea1f71e37cb3e33cd8e9..d53056d9ee3ff34fedc5ec5240e31639c1105672 100644 (file)
@@ -597,17 +597,18 @@ wxMenuItem* wxMenuBase::FindItemByPosition(size_t position) const
 // window will be used.
 void wxMenuBase::UpdateUI(wxEvtHandler* source)
 {
-    if (GetInvokingWindow())
+    wxWindow * const win = GetWindow();
+    if ( win )
     {
         // Don't update menus if the parent
         // frame is about to get deleted
-        wxWindow *tlw = wxGetTopLevelParent( GetInvokingWindow() );
+        wxWindow *tlw = wxGetTopLevelParent(win);
         if (tlw && wxPendingDelete.Member(tlw))
             return;
     }
 
-    if ( !source && GetInvokingWindow() )
-        source = GetInvokingWindow()->GetEventHandler();
+    if ( !source && win )
+        source = win->GetEventHandler();
     if ( !source )
         source = GetEventHandler();
     if ( !source )