Fix possible deadlock in wxEvtHandler::ProcessPendingEvents().

Delete the event we just processed before re-locking the critical section as
this may result in deadlocks if the (user-defined) event dtor does something
non-trivial.

Closes #10790.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@61982 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-09-20 21:48:50 +00:00
parent c78e95f633
commit f15c021bb6

View File

@@ -1181,6 +1181,7 @@ void wxEvtHandler::ProcessPendingEvents()
for ( wxList::compatibility_iterator node = m_pendingEvents->GetFirst(); for ( wxList::compatibility_iterator node = m_pendingEvents->GetFirst();
node; node;
node = m_pendingEvents->GetFirst() ) node = m_pendingEvents->GetFirst() )
{
{ {
wxEventPtr event(wx_static_cast(wxEvent *, node->GetData())); wxEventPtr event(wx_static_cast(wxEvent *, node->GetData()));
@@ -1193,6 +1194,9 @@ void wxEvtHandler::ProcessPendingEvents()
wxLEAVE_CRIT_SECT( Lock() ); wxLEAVE_CRIT_SECT( Lock() );
ProcessEvent(*event); ProcessEvent(*event);
} // delete the event at this block exit, before re-locking our
// critical section, to avoid deadlocks if the event dtor locks
// something else itself (see #10790)
wxENTER_CRIT_SECT( Lock() ); wxENTER_CRIT_SECT( Lock() );