X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/81f6ea4a29eb815dbed0adea369efdc8fece0269..ec7a8d025681979d9ea9e01350f689f5005a63ee:/src/common/event.cpp?ds=sidebyside diff --git a/src/common/event.cpp b/src/common/event.cpp index 31196f57c4..7597499232 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -1084,7 +1084,10 @@ void wxEvtHandler::AddPendingEvent(wxEvent& event) wxENTER_CRIT_SECT( Lock() ); if ( !m_pendingEvents ) + { m_pendingEvents = new wxList; + m_pendingEvents->DeleteContents(true); + } m_pendingEvents->Append(eventCopy); @@ -1101,7 +1104,7 @@ void wxEvtHandler::AddPendingEvent(wxEvent& event) wxLEAVE_CRIT_SECT(*wxPendingEventsLocker); - // 3) Inform the system that new pending events are somwehere, + // 3) Inform the system that new pending events are somewhere, // and that these should be processed in idle time. wxWakeUpIdle(); } @@ -1126,15 +1129,14 @@ void wxEvtHandler::ProcessPendingEvents() { wxEvent *event = (wxEvent *)node->GetData(); - m_pendingEvents->Erase(node); - wxLEAVE_CRIT_SECT( Lock() ); ProcessEvent(*event); - delete event; wxENTER_CRIT_SECT( Lock() ); + m_pendingEvents->Erase(node); + if ( !--n ) break; }