git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38008 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
         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 =
                 return true;
             }
         }
-
-        node = node->GetNext();
     }
 
     return false;