X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4677003143f4d12c979a92a1ac3970afd166973d..75b2220ebaf4b922be747a16c8cc7d7dfdac0fad:/src/common/event.cpp diff --git a/src/common/event.cpp b/src/common/event.cpp index 5db5744639..4bc7989682 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -1675,15 +1675,6 @@ wxEvtHandler::DoUnbind(int id, if (!m_dynamicEvents) return false; - // Remove connection from tracker node (wxEventConnectionRef) - wxEvtHandler *eventSink = func.GetEvtHandler(); - if ( eventSink && eventSink != this ) - { - wxEventConnectionRef *evtConnRef = FindRefInTrackerList(eventSink); - if ( evtConnRef ) - evtConnRef->DecRef(); - } - wxList::compatibility_iterator node = m_dynamicEvents->GetFirst(); while (node) { @@ -1695,6 +1686,15 @@ wxEvtHandler::DoUnbind(int id, entry->m_fn->IsMatching(func) && ((entry->m_callbackUserData == userData) || !userData)) { + // Remove connection from tracker node (wxEventConnectionRef) + wxEvtHandler *eventSink = entry->m_fn->GetEvtHandler(); + if ( eventSink && eventSink != this ) + { + wxEventConnectionRef *evtConnRef = FindRefInTrackerList(eventSink); + if ( evtConnRef ) + evtConnRef->DecRef(); + } + delete entry->m_callbackUserData; m_dynamicEvents->Erase( node ); delete entry;