]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/menucmn.cpp
moved to tests/regex
[wxWidgets.git] / src / common / menucmn.cpp
index 4cca372c6207905350c3b3b5b30b97ed899f66a4..62118b53b5f87a0ed155f0e3b65e564f72c90b0c 100644 (file)
@@ -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 )