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
This commit is contained in:
@@ -44,6 +44,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/thread.h"
|
#include "wx/thread.h"
|
||||||
|
#include "wx/ptr_scpd.h"
|
||||||
|
|
||||||
|
wxDECLARE_SCOPED_PTR(wxEvent, wxEventPtr)
|
||||||
|
wxDEFINE_SCOPED_PTR(wxEvent, wxEventPtr)
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxWin macros
|
// wxWin macros
|
||||||
@@ -1167,7 +1171,7 @@ void wxEvtHandler::ProcessPendingEvents()
|
|||||||
"should have pending events if called" );
|
"should have pending events if called" );
|
||||||
|
|
||||||
wxList::compatibility_iterator node = m_pendingEvents->GetFirst();
|
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
|
// 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
|
// 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
|
// careful: this object could have been deleted by the event handler
|
||||||
// executed by the above ProcessEvent() call, so we can't access any fields
|
// executed by the above ProcessEvent() call, so we can't access any fields
|
||||||
// of this object any more
|
// of this object any more
|
||||||
|
|
||||||
delete event;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user