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

@@ -313,6 +313,9 @@ public:
//to the list of the handlers with _delayed_ pending events
void DelayPendingEventHandler(wxEvtHandler* toDelay);
// deletes the current pending events
void DeletePendingEvents();
// wxEventLoop redirections
// ------------------------
@@ -420,11 +423,17 @@ protected:
// been started yet or has already terminated)
wxEventLoopBase *m_mainLoop;
// pending events management vars:
// the array of the handlers with pending events which needs to be processed
// inside ProcessPendingEvents()
wxEvtHandlerArray m_handlersWithPendingEvents;
// helper array used by ProcessPendingEvents()
// helper array used by ProcessPendingEvents() to store the event handlers
// which have pending events but of these events none can be processed right now
// (because of a call to wxEventLoop::YieldFor() which asked to selectively process
// pending events)
wxEvtHandlerArray m_handlersWithPendingDelayedEvents;
#if wxUSE_THREADS
@@ -432,6 +441,9 @@ protected:
wxCriticalSection m_handlersWithPendingEventsLocker;
#endif
// flag modified by Suspend/ResumeProcessingOfPendingEvents()
bool m_bDoPendingEventProcessing;
friend class WXDLLIMPEXP_FWD_BASE wxEvtHandler;
// the application object is a singleton anyhow, there is no sense in

View File

@@ -2864,7 +2864,6 @@ public:
// Event queuing and processing
// ----------------------------
// Process an event right now: this can only be called from the main
// thread, use QueueEvent() for scheduling the events for
// processing from other threads.
@@ -2900,9 +2899,11 @@ public:
void ProcessPendingEvents();
// NOTE: uses ProcessEvent()
void DeletePendingEvents();
#if wxUSE_THREADS
bool ProcessThreadEvent(const wxEvent& event);
// NOTE: uses AddPendingEvent()
// NOTE: uses AddPendingEvent(); call only from secondary threads
#endif