summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-10-14 14:08:19 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-10-14 14:11:12 (GMT)
commitc9f819e118454f6562ae5dbb25f28105a804c190 (patch)
tree34fc8f239730fad029aea7f97aa12422595198c3 /src
parent8e4d6e42629feea38376e429462dc045354f8255 (diff)
downloadQt-c9f819e118454f6562ae5dbb25f28105a804c190.zip
Qt-c9f819e118454f6562ae5dbb25f28105a804c190.tar.gz
Qt-c9f819e118454f6562ae5dbb25f28105a804c190.tar.bz2
Cocoa: QInputDialog autotest reveals event dispatcher bug
On Cocoa, we sometimes need to block sending posted events (because we need to flush the event que now and then without touching Qt events). But we forgot to do same for timer callback. So this patch makes sure that we dont send the timer event immidiatly if we are just flushing the event que. Rev-By: brad
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index 49c851b..c9dd949 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -136,14 +136,19 @@ void QEventDispatcherMacPrivate::activateTimer(CFRunLoopTimerRef, void *info)
if (tmr == 0 || tmr->pending == true)
return; // Can't send another timer event if it's pending.
- tmr->pending = true;
- QTimerEvent e(tmr->id);
- qt_sendSpontaneousEvent(tmr->obj, &e);
- // Get the value again in case the timer gets unregistered during the sendEvent.
- tmr = macTimerHash.value(timerID);
- if (tmr != 0)
- tmr->pending = false;
+ if (blockSendPostedEvents) {
+ QCoreApplication::postEvent(tmr->obj, new QTimerEvent(tmr->id));
+ } else {
+ tmr->pending = true;
+ QTimerEvent e(tmr->id);
+ qt_sendSpontaneousEvent(tmr->obj, &e);
+ // Get the value again in case the timer gets unregistered during the sendEvent.
+ tmr = macTimerHash.value(timerID);
+ if (tmr != 0)
+ tmr->pending = false;
+ }
+
}
void QEventDispatcherMac::registerTimer(int timerId, int interval, QObject *obj)
@@ -767,7 +772,7 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession()
// Sadly, we need to introduce this little event flush
// to stop dialogs from blinking/poping in front if a
// modal session restart was needed:
- while (NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask
+ while (NSEvent *event = [NSApp nextEventMatchingMask:0
untilDate:nil
inMode:NSDefaultRunLoopMode
dequeue: YES]) {