From 142a233c8cbcb3f9bb3f73f3b13849c7f4880114 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 8 Nov 2008 22:41:10 +0000 Subject: [PATCH] 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 --- src/common/event.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/event.cpp b/src/common/event.cpp index c180771b17..2e6e46ba3e 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -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