From 47b6fabc7d0405bbbd3d9efd516c44f0b5b94dfc Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 26 Jan 2008 23:18:30 +0000 Subject: [PATCH] delete the event object in ProcessPendingEvents() even if the handler throws an exception (bug 1836010) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/event.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/event.cpp b/src/common/event.cpp index a03b9fe..0ba18aa 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -44,6 +44,10 @@ #endif #include "wx/thread.h" +#include "wx/ptr_scpd.h" + +wxDECLARE_SCOPED_PTR(wxEvent, wxEventPtr) +wxDEFINE_SCOPED_PTR(wxEvent, wxEventPtr) // ---------------------------------------------------------------------------- // wxWin macros @@ -1167,7 +1171,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 +1190,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; } /* -- 2.7.4