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/branches/WX_2_8_BRANCH@51391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-01-26 23:18:30 +00:00
parent 57f27af169
commit 29f1f4864e

View File

@@ -41,6 +41,11 @@
#endif // wxUSE_GUI
#endif
#include "wx/ptr_scpd.h"
wxDECLARE_SCOPED_PTR(wxEvent, wxEventPtr)
wxDEFINE_SCOPED_PTR(wxEvent, wxEventPtr)
// ----------------------------------------------------------------------------
// wxWin macros
// ----------------------------------------------------------------------------
@@ -1170,9 +1175,9 @@ void wxEvtHandler::ProcessPendingEvents()
node;
node = m_pendingEvents->GetFirst() )
{
wxEvent *event = (wxEvent *)node->GetData();
wxEventPtr event(wx_static_cast(wxEvent *, node->GetData()));
// It's importan we remove event from list before processing it.
// 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 same event again.
@@ -1182,8 +1187,6 @@ void wxEvtHandler::ProcessPendingEvents()
ProcessEvent(*event);
delete event;
wxENTER_CRIT_SECT( Lock() );
if ( --n == 0 )