]> git.saurik.com Git - wxWidgets.git/commitdiff
Apply patch that prevents a crash when more than
authorRobert Roebling <robert@roebling.de>
Sun, 24 Apr 2005 16:40:53 +0000 (16:40 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 24 Apr 2005 16:40:53 +0000 (16:40 +0000)
   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

src/common/event.cpp

index 7bb9ba699dfab4ec1b97b804a6e8f9b251f4b8ca..5f24b7489ffe84d127475de6058acc80913856c6 100644 (file)
@@ -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);