X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cd30330fc67d0fe32f325ab16f2764cbd90d24af..172541f64be8fcddb08f1c121da256d08c24a70b:/src/common/event.cpp diff --git a/src/common/event.cpp b/src/common/event.cpp index da707a1887..7bb9ba699d 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -265,6 +265,7 @@ DEFINE_EVENT_TYPE(wxEVT_MOVING) DEFINE_EVENT_TYPE(wxEVT_CLOSE_WINDOW) DEFINE_EVENT_TYPE(wxEVT_END_SESSION) DEFINE_EVENT_TYPE(wxEVT_QUERY_END_SESSION) +DEFINE_EVENT_TYPE(wxEVT_HIBERNATE) DEFINE_EVENT_TYPE(wxEVT_ACTIVATE_APP) DEFINE_EVENT_TYPE(wxEVT_POWER) DEFINE_EVENT_TYPE(wxEVT_ACTIVATE) @@ -1123,30 +1124,28 @@ void wxEvtHandler::ProcessPendingEvents() wxENTER_CRIT_SECT( Lock() ); - // remember last event to process during this iteration - wxList::compatibility_iterator lastPendingNode = m_pendingEvents->GetLast(); - - wxList::compatibility_iterator node = m_pendingEvents->GetFirst(); - while ( node ) + // we leave the loop once we have processed all events that were present at + // the start of ProcessPendingEvents because otherwise we could get into + // infinite loop if the pending event handler execution resulted in another + // event being posted + size_t n = m_pendingEvents->size(); + for ( wxList::compatibility_iterator node = m_pendingEvents->GetFirst(); + node; + node = m_pendingEvents->GetFirst() ) { wxEvent *event = (wxEvent *)node->GetData(); + m_pendingEvents->Erase(node); - // In ProcessEvent, new events might get added and - // we can safely leave the crtical section here. wxLEAVE_CRIT_SECT( Lock() ); + ProcessEvent(*event); delete event; + wxENTER_CRIT_SECT( Lock() ); - // leave the loop once we have processed all events that were present - // at the start of ProcessPendingEvents because otherwise we could get - // into infinite loop if the pending event handler execution resulted - // in another event being posted - if ( node == lastPendingNode ) + if ( !--n ) break; - - node = m_pendingEvents->GetFirst(); } wxLEAVE_CRIT_SECT( Lock() );