X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/163b01c128461268b82035b2c1fd2233b827cce6..d57d0505d4c2186592833f18c3d40532d3a4bf0e:/src/common/menucmn.cpp?ds=sidebyside diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 32f525d673..f34a5bf0f6 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -597,17 +597,10 @@ wxMenuItem* wxMenuBase::FindItemByPosition(size_t position) const // window will be used. void wxMenuBase::UpdateUI(wxEvtHandler* source) { - if (GetInvokingWindow()) - { - // Don't update menus if the parent - // frame is about to get deleted - wxWindow *tlw = wxGetTopLevelParent( GetInvokingWindow() ); - if (tlw && wxPendingDelete.Member(tlw)) - return; - } + wxWindow * const win = GetWindow(); - if ( !source && GetInvokingWindow() ) - source = GetInvokingWindow()->GetEventHandler(); + if ( !source && win ) + source = win->GetEventHandler(); if ( !source ) source = GetEventHandler(); if ( !source ) @@ -621,7 +614,7 @@ void wxMenuBase::UpdateUI(wxEvtHandler* source) { wxWindowID itemid = item->GetId(); wxUpdateUIEvent event(itemid); - event.SetEventObject( source ); + event.SetEventObject( this ); if ( source->ProcessEvent(event) ) { @@ -1045,18 +1038,13 @@ wxString wxMenuBarBase::GetHelpString(int itemid) const void wxMenuBarBase::UpdateMenus() { - wxEvtHandler* source; wxMenu* menu; int nCount = GetMenuCount(); for (int n = 0; n < nCount; n++) { menu = GetMenu( n ); if (menu != NULL) - { - source = menu->GetEventHandler(); - if (source != NULL) - menu->UpdateUI( source ); - } + menu->UpdateUI( NULL ); } }