From: Robert Roebling Date: Sun, 24 Apr 2005 16:40:53 +0000 (+0000) Subject: Apply patch that prevents a crash when more than X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5d9d1b88100b11e56f66d0e7cd955adbc17a40fd Apply patch that prevents a crash when more than one event from a single event handler has been added in AddPendingEvents() and the event handler is destroyed before the pending events get sent. Sofar, only the first pointer to the event handler was removed which could lead to a crash. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33871 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- 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);