X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/afafd942a1f9d0f683a95bb72f8bc1e128543749..659af826726fea66d2476d3a0ead2fb00e34ad23:/src/common/event.cpp diff --git a/src/common/event.cpp b/src/common/event.cpp index 7bb9ba699d..5f24b7489f 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -1044,8 +1044,10 @@ wxEvtHandler::~wxEvtHandler() // Remove us from wxPendingEvents if necessary. if(wxPendingEventsLocker) wxENTER_CRIT_SECT(*wxPendingEventsLocker); - if ( wxPendingEvents ) { - wxPendingEvents->DeleteObject(this); + if ( wxPendingEvents ) + { + // Delete all occurences of this from the list of pending events + while (wxPendingEvents->DeleteObject(this)) { } // Do nothing } if(wxPendingEventsLocker) wxLEAVE_CRIT_SECT(*wxPendingEventsLocker);