X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/63e819f2981585279fe8a06629f69b7002eee9dc..db71eb0640221199170ac9ea83371c2d467fa456:/src/common/event.cpp?ds=inline diff --git a/src/common/event.cpp b/src/common/event.cpp index 5e40721437..df764235ac 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -31,6 +31,7 @@ #include "wx/app.h" #include "wx/utils.h" #include "wx/stopwatch.h" + #include "wx/module.h" #if wxUSE_GUI #include "wx/control.h" @@ -40,8 +41,6 @@ #endif // wxUSE_GUI #endif -#include "wx/module.h" - // ---------------------------------------------------------------------------- // wxWin macros // ---------------------------------------------------------------------------- @@ -1012,6 +1011,10 @@ wxEvtHandler::wxEvtHandler() m_eventsLocker = new wxCriticalSection; # endif #endif + // reentrace not allowed by default + m_reentranceAllowed = false; + m_eventHandlingInProgress = false; + // no client data (yet) m_clientData = NULL; m_clientDataType = wxClientData_None; @@ -1132,10 +1135,13 @@ void wxEvtHandler::AddPendingEvent(wxEvent& event) void wxEvtHandler::ProcessPendingEvents() { - // this method is only called by wxApp if this handler does have pending - // events + // this method is only called by wxApp if this handler does have + // pending events wxCHECK_RET( m_pendingEvents, wxT("Please call wxApp::ProcessPendingEvents() instead") ); + + // eventhandling is now in progess + m_eventHandlingInProgress = true; wxENTER_CRIT_SECT( Lock() ); @@ -1153,11 +1159,13 @@ void wxEvtHandler::ProcessPendingEvents() // It's importan we remove event from list before processing it. // Else a nested event loop, for example from a modal dialog, might // process the same event again. + m_pendingEvents->Erase(node); wxLEAVE_CRIT_SECT( Lock() ); ProcessEvent(*event); + delete event; wxENTER_CRIT_SECT( Lock() ); @@ -1167,6 +1175,9 @@ void wxEvtHandler::ProcessPendingEvents() } wxLEAVE_CRIT_SECT( Lock() ); + + // eventhandling no longer in progess + m_eventHandlingInProgress = false; } /*