]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't send idle events to the windows about to be destroyed.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 29 Dec 2011 22:05:31 +0000 (22:05 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 29 Dec 2011 22:05:31 +0000 (22:05 +0000)
This is useless and can apparently result in some problems as of r25877 and
r25877 (from 8 years ago) added explicit checks preventing processing such
events in wxToolBar and wxMenu. Instead, simply don't generate these events in
the first place and also remove the now unnecessary checks for them.

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

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

index 6eb1fc78d4c578f7aa0e2a850f838c4549b5b3f8..1a280042f1b015aeab816e0a271ed72475d9e080 100644 (file)
@@ -349,7 +349,10 @@ bool wxAppBase::ProcessIdle()
     while (node)
     {
         wxWindow* win = node->GetData();
-        if (win->SendIdleEvents(event))
+
+        // Don't send idle events to the windows that are about to be destroyed
+        // anyhow, this is wasteful and unexpected.
+        if ( !wxPendingDelete.Member(win) && win->SendIdleEvents(event) )
             needMore = true;
         node = node->GetNext();
     }
index d53056d9ee3ff34fedc5ec5240e31639c1105672..9f7d8128c5df28a21b51be8e008059ed7d69e8f8 100644 (file)
@@ -598,14 +598,6 @@ wxMenuItem* wxMenuBase::FindItemByPosition(size_t position) const
 void wxMenuBase::UpdateUI(wxEvtHandler* source)
 {
     wxWindow * const win = GetWindow();
-    if ( win )
-    {
-        // Don't update menus if the parent
-        // frame is about to get deleted
-        wxWindow *tlw = wxGetTopLevelParent(win);
-        if (tlw && wxPendingDelete.Member(tlw))
-            return;
-    }
 
     if ( !source && win )
         source = win->GetEventHandler();
index ced3746df2c433c407c95437c24a7ded2bac50f3..2a33c1979bf8d61f340400252f8f3cc9c6dd090c 100644 (file)
@@ -701,12 +701,6 @@ void wxToolBarBase::UpdateWindowUI(long flags)
     if ( !IsShown() )
         return;
 
-    // There is no sense in updating the toolbar UI
-    // if the parent window is about to get destroyed
-    wxWindow *tlw = wxGetTopLevelParent( this );
-    if (tlw && wxPendingDelete.Member( tlw ))
-        return;
-
     wxEvtHandler* evtHandler = GetEventHandler() ;
 
     for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();