]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't do toolbar and menu UI updates if
authorRobert Roebling <robert@roebling.de>
Fri, 20 Feb 2004 22:32:00 +0000 (22:32 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 20 Feb 2004 22:32:00 +0000 (22:32 +0000)
    the owning frame or TLW is about to
    get deleted anyway.

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

src/common/menucmn.cpp
src/common/tbarbase.cpp

index 3b2c9d37aac659c8df4e8ceaed4f70217cf93537..62118b53b5f87a0ed155f0e3b65e564f72c90b0c 100644 (file)
@@ -537,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 )
index d78bcf6fe8886713369a32749aa535d49b2a9da3..d2243fedf2cd3b1f25719b798484aaa997b5dff1 100644 (file)
@@ -623,7 +623,8 @@ void wxToolBarBase::UpdateWindowUI(long flags)
 
     // There is no sense in updating the toolbar UI
     // if the parent window is about to get destroyed
-    if (GetParent() && wxPendingDelete.Member( GetParent() ))
+    wxWindow *tlw = wxGetTopLevelParent( this );
+    if (tlw && wxPendingDelete.Member( tlw ))
         return;
 
     wxEvtHandler* evtHandler = GetEventHandler() ;