From 632c106cd5d391f8ddbe11f2458588c45caa5382 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 2 Mar 2014 18:27:51 +0000 Subject: [PATCH] Don't dispatch pending events from selective YieldFor(). Pending events list can contain events from all kinds and dispatching them from YieldFor() called to dispatch the events of some particular kind only (e.g. to redraw the window) is unexpected and wrong, e.g. it breaks some uses of wxProgressDialog, see #15799. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76060 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/evtloop.cpp | 7 ++++++- src/msw/evtloop.cpp | 2 +- src/os2/evtloop.cpp | 2 +- src/osx/core/evtloop_cf.cpp | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gtk/evtloop.cpp b/src/gtk/evtloop.cpp index 59d0e31c18..4c93056000 100644 --- a/src/gtk/evtloop.cpp +++ b/src/gtk/evtloop.cpp @@ -395,7 +395,12 @@ bool wxGUIEventLoop::YieldFor(long eventsToProcess) // Process all pending events too, this is consistent with wxMSW behaviour // and the behaviour of wxGTK itself in the previous versions. - if ( wxTheApp ) + // + // Notice however that we must not do it if we're asked to process only the + // events of specific kind, as pending events could be of any kind at all + // (ideal would be to have a filtering version of ProcessPendingEvents() + // too but we don't have this right now). + if ( eventsToProcess == wxEVT_CATEGORY_ALL && wxTheApp ) wxTheApp->ProcessPendingEvents(); if (eventsToProcess != wxEVT_CATEGORY_CLIPBOARD) diff --git a/src/msw/evtloop.cpp b/src/msw/evtloop.cpp index 7c861c3fae..f39ebc50b0 100644 --- a/src/msw/evtloop.cpp +++ b/src/msw/evtloop.cpp @@ -435,7 +435,7 @@ bool wxGUIEventLoop::YieldFor(long eventsToProcess) } // if there are pending events, we must process them. - if (wxTheApp) + if ( eventsToProcess == wxEVT_CATEGORY_ALL && wxTheApp ) wxTheApp->ProcessPendingEvents(); // put back unprocessed events in the queue diff --git a/src/os2/evtloop.cpp b/src/os2/evtloop.cpp index 0267057888..1ab8cb8fca 100644 --- a/src/os2/evtloop.cpp +++ b/src/os2/evtloop.cpp @@ -400,7 +400,7 @@ bool wxGUIEventLoop::YieldFor(long eventsToProcess) // // If they are pending events, we must process them. // - if (wxTheApp) + if (eventsToProcess == wxEVT_CATEGORY_ALL && wxTheApp) { wxTheApp->ProcessPendingEvents(); wxTheApp->HandleSockets(); diff --git a/src/osx/core/evtloop_cf.cpp b/src/osx/core/evtloop_cf.cpp index 7e70dec8b1..4718fa7ae8 100644 --- a/src/osx/core/evtloop_cf.cpp +++ b/src/osx/core/evtloop_cf.cpp @@ -214,7 +214,7 @@ bool wxCFEventLoop::YieldFor(long eventsToProcess) while ( ProcessIdle() ) {} // if there are pending events, we must process them. - if (wxTheApp) + if ( eventsToProcess == wxEVT_CATEGORY_ALL && wxTheApp ) wxTheApp->ProcessPendingEvents(); #if wxUSE_LOG