X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5f12ae5cd76b3e9157bdf29e1df4f875cbd6d3e3..c27eab7e9ce512e052046886a33c5f5002d42573:/src/gtk/app.cpp diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index afe49ce3c1..93459c373d 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -46,6 +46,10 @@ wxApp *wxTheApp = (wxApp *) NULL; wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL; extern wxList wxPendingDelete; +#if wxUSE_THREADS +extern wxList wxPendingEvents; +extern wxCriticalSection wxPendingEventsLocker; +#endif extern wxResourceCache *wxTheResourceCache; unsigned char g_palette[64*3] = @@ -283,6 +287,10 @@ void wxApp::OnIdle( wxIdleEvent &event ) inOnIdle = TRUE; + /* Resend in the main thread events which have been prepared in other + threads */ + ProcessPendingEvents(); + /* 'Garbage' collection of windows deleted with Close(). */ DeletePendingObjects(); @@ -366,6 +374,25 @@ void wxApp::Dispatch() { } +#if wxUSE_THREADS +void wxApp::ProcessPendingEvents() +{ + wxNode *node = wxPendingEvents.First(); + wxCriticalSectionLocker locker(wxPendingEventsLocker); + + while (node) + { + wxEvtHandler *handler = (wxEvtHandler *)node->Data(); + + handler->ProcessPendingEvents(); + + delete node; + + node = wxPendingEvents.First(); + } +} +#endif + void wxApp::DeletePendingObjects() { wxNode *node = wxPendingDelete.First();