]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/event.cpp
extracted duplicated code from src/*/data.cpp in a common file
[wxWidgets.git] / src / common / event.cpp
index 29c728164fbed98d1daf96e482cf9db55614a697..b2dc2e82f46194ef3a014650685b67456f9dec3c 100644 (file)
@@ -5,7 +5,7 @@
 // Modified by:
 // Created:     01/02/97
 // RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart and Markus Holzem
+// Copyright:   (c) Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
@@ -656,6 +656,15 @@ wxEvtHandler::~wxEvtHandler()
 #  if !defined(__VISAGECPP__)
     delete m_eventsLocker;
 #  endif
+   
+    // Remove us from wxPendingEvents if necessary.
+    if(wxPendingEventsLocker)
+        wxENTER_CRIT_SECT(*wxPendingEventsLocker);
+    if ( wxPendingEvents ) {
+        wxPendingEvents->DeleteObject(this);
+    }
+    if(wxPendingEventsLocker)
+        wxLEAVE_CRIT_SECT(*wxPendingEventsLocker);
 #endif
 
     // we only delete object data, not untyped