]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/event.cpp
Fix most of the Objective-C GC problems by using the stronger CFRetain/CFRelease...
[wxWidgets.git] / src / common / event.cpp
index a03b9fe1b92a9df9f9c84898cc5dd647763c8935..d122c8d43484a92cf926e743004a6473067705eb 100644 (file)
 
 #include "wx/thread.h"
 
+#if wxUSE_BASE
+    #include "wx/ptr_scpd.h"
+
+    wxDECLARE_SCOPED_PTR(wxEvent, wxEventPtr)
+    wxDEFINE_SCOPED_PTR(wxEvent, wxEventPtr)
+#endif // wxUSE_BASE
+
 // ----------------------------------------------------------------------------
 // wxWin macros
 // ----------------------------------------------------------------------------
@@ -1167,7 +1174,7 @@ void wxEvtHandler::ProcessPendingEvents()
                  "should have pending events if called" );
 
     wxList::compatibility_iterator node = m_pendingEvents->GetFirst();
-    wxEvent * const event = wx_static_cast(wxEvent *, node->GetData());
+    wxEventPtr event(wx_static_cast(wxEvent *, node->GetData()));
 
     // it's important we remove event from list before processing it, else a
     // nested event loop, for example from a modal dialog, might process the
@@ -1186,8 +1193,6 @@ void wxEvtHandler::ProcessPendingEvents()
     // careful: this object could have been deleted by the event handler
     // executed by the above ProcessEvent() call, so we can't access any fields
     // of this object any more
-
-    delete event;
 }
 
 /*