X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9add93670bb4a38e4007b8422b34b29b6194eecb..99e839da3c9c40a3dac7cf1bb841d6459fcac1b0:/src/common/menucmn.cpp?ds=sidebyside diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 4cca372c62..62118b53b5 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -72,6 +72,10 @@ wxMenuItemBase::wxMenuItemBase(wxMenu *parentMenu, m_isChecked = FALSE; m_id = id; m_kind = kind; + if (m_id == wxID_ANY) + m_id = wxNewId(); + if (m_id == wxID_SEPARATOR) + m_kind = wxITEM_SEPARATOR; } wxMenuItemBase::~wxMenuItemBase() @@ -533,6 +537,15 @@ 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; + } + if ( !source && GetInvokingWindow() ) source = GetInvokingWindow()->GetEventHandler(); if ( !source )