diff options
author | =l.lunak <l.lunak@suse.cz> | 2010-10-27 14:26:08 (GMT) |
---|---|---|
committer | Qt Commercial Integration <QtCommercial@digia.com> | 2012-01-31 10:24:44 (GMT) |
commit | 4e00ed2a97bf1438cc68911ac75d61d2330abea8 (patch) | |
tree | 612fc7805dce85b1e469205c7f7d31b35eeda483 /src | |
parent | 5d1d64cc3d25319d456db1c29cb52a0795197bf8 (diff) | |
download | Qt-4e00ed2a97bf1438cc68911ac75d61d2330abea8.zip Qt-4e00ed2a97bf1438cc68911ac75d61d2330abea8.tar.gz Qt-4e00ed2a97bf1438cc68911ac75d61d2330abea8.tar.bz2 |
fix QEventLoop::X11ExcludeTimers with Glib event loop
When GSource prepare or check functions return TRUE, Glib does not
necessary call the dispatch function immediatelly (probably depends
on the ordering of processing events). This means that
timerSourceDispatch() may get called from different call of
QEventDispatcherGlib::processEvents() than its accompanying
timerSourcePrepareHelper() or timerSourceCheckHelper().
This is a problem if a timer becomes pending during a normal
processEvents() call but will only be executed during a call
to processEvents() with QEventLoop::X11ExcludeTimers. The attached
patch fixes this problem by rescheduling the timer for another pass.
As for a testcase, this happens when making LibreOffice's KDE
integration use Qt event loop, requires setting the useEventLoop
property on the QClipboard object, so I'm afraid I don't have anything
simple. But fact that Glib can keep an event pending for a little
moment is rather obvious from its sources or can be triggered
from any Qt application, and I hope the rest is an obvious consequence.
Merge-request: 2492
Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_glib.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp index 00c3eab..176048d 100644 --- a/src/corelib/kernel/qeventdispatcher_glib.cpp +++ b/src/corelib/kernel/qeventdispatcher_glib.cpp @@ -180,6 +180,8 @@ static gboolean timerSourceCheck(GSource *source) static gboolean timerSourceDispatch(GSource *source, GSourceFunc, gpointer) { GTimerSource *timerSource = reinterpret_cast<GTimerSource *>(source); + if (timerSource->processEventsFlags & QEventLoop::X11ExcludeTimers) + return true; timerSource->runWithIdlePriority = true; (void) timerSource->timerList.activateTimers(); return true; // ??? don't remove, right again? |