add wxAppConsoleBase::DeletePendingEvents and wxEvtHandler::DeletePendingEvents.

Fix wxAppConsoleBase::Suspend/ResumeProcessingOfPendingEvents: locking the mutex does not prevent wxAppConsoleBase::ProcessPendingEvents from running if the mutex was locked from the main thread!

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59433 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-03-08 12:58:24 +00:00
parent db034c5228
commit cae9e7b169
6 changed files with 97 additions and 13 deletions

View File

@@ -1079,14 +1079,12 @@ wxEvtHandler::~wxEvtHandler()
delete m_dynamicEvents;
}
if (m_pendingEvents)
m_pendingEvents->DeleteContents(true);
delete m_pendingEvents;
// Remove us from the list of the pending events if necessary.
if (wxTheApp)
wxTheApp->RemovePendingEventHandler(this);
DeletePendingEvents();
// we only delete object data, not untyped
if ( m_clientDataType == wxClientData_Object )
delete m_clientObject;
@@ -1147,7 +1145,7 @@ void wxEvtHandler::QueueEvent(wxEvent *event)
wxENTER_CRIT_SECT( m_pendingEventsLock );
if ( !m_pendingEvents )
m_pendingEvents = new wxList;
m_pendingEvents = new wxList;
m_pendingEvents->Append(event);
@@ -1169,6 +1167,13 @@ void wxEvtHandler::QueueEvent(wxEvent *event)
wxWakeUpIdle();
}
void wxEvtHandler::DeletePendingEvents()
{
if (m_pendingEvents)
m_pendingEvents->DeleteContents(true);
wxDELETE(m_pendingEvents);
}
void wxEvtHandler::ProcessPendingEvents()
{
if (!wxTheApp)