git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51391 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
 #endif
 
 #include "wx/thread.h"
 #endif
 
 #include "wx/thread.h"
+#include "wx/ptr_scpd.h"
+
+wxDECLARE_SCOPED_PTR(wxEvent, wxEventPtr)
+wxDEFINE_SCOPED_PTR(wxEvent, wxEventPtr)
 
 // ----------------------------------------------------------------------------
 // wxWin macros
 
 // ----------------------------------------------------------------------------
 // wxWin macros
                  "should have pending events if called" );
 
     wxList::compatibility_iterator node = m_pendingEvents->GetFirst();
                  "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
 
     // 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
     // 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
     // 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