fix race condition which could result in assert failures in debug builds and infinite loops in release (#9094)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@56712 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1040,7 +1040,7 @@ wxEvtHandler::wxEvtHandler()
|
||||
m_eventsLocker = new wxCriticalSection;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// no client data (yet)
|
||||
m_clientData = NULL;
|
||||
m_clientDataType = wxClientData_None;
|
||||
@@ -1142,8 +1142,6 @@ void wxEvtHandler::AddPendingEvent(wxEvent& event)
|
||||
|
||||
m_pendingEvents->Append(eventCopy);
|
||||
|
||||
wxLEAVE_CRIT_SECT( Lock() );
|
||||
|
||||
// 2) Add this event handler to list of event handlers that
|
||||
// have pending events.
|
||||
|
||||
@@ -1155,6 +1153,8 @@ void wxEvtHandler::AddPendingEvent(wxEvent& event)
|
||||
|
||||
wxLEAVE_CRIT_SECT(*wxPendingEventsLocker);
|
||||
|
||||
wxLEAVE_CRIT_SECT( Lock() );
|
||||
|
||||
// 3) Inform the system that new pending events are somewhere,
|
||||
// and that these should be processed in idle time.
|
||||
wxWakeUpIdle();
|
||||
@@ -1166,7 +1166,7 @@ void wxEvtHandler::ProcessPendingEvents()
|
||||
// pending events
|
||||
wxCHECK_RET( m_pendingEvents,
|
||||
wxT("Please call wxApp::ProcessPendingEvents() instead") );
|
||||
|
||||
|
||||
wxENTER_CRIT_SECT( Lock() );
|
||||
|
||||
// we leave the loop once we have processed all events that were present at
|
||||
|
Reference in New Issue
Block a user