]> git.saurik.com Git - wxWidgets.git/commitdiff
deal with the situation when a (dynamic) event handler disconnects itself during...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 11 Mar 2006 21:50:44 +0000 (21:50 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 11 Mar 2006 21:50:44 +0000 (21:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38008 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/event.cpp

index 6da2424443fd3dc654650f555e38a7888c45e379..e0ea296ae23ed5b35c9f551fb9a15de0925335bb 100644 (file)
@@ -1344,6 +1344,10 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event )
         wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData();
 #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
 
+        // get next node before (maybe) calling the event handler as it could
+        // call Disconnect() invalidating the current node
+        node = node->GetNext();
+
         if ((event.GetEventType() == entry->m_eventType) && (entry->m_fn != 0))
         {
             wxEvtHandler *handler =
@@ -1358,8 +1362,6 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event )
                 return true;
             }
         }
-
-        node = node->GetNext();
     }
 
     return false;