summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-04-08 09:07:33 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-04-08 09:28:06 (GMT)
commit74f092408d1a870e2c1e2a49182c8e09f952055d (patch)
treebc3fd9f069ecd84a842650ba028df6d46f850238 /src/corelib
parentc131208e59f5b2dd517b00c4539458760b8fd8aa (diff)
downloadQt-74f092408d1a870e2c1e2a49182c8e09f952055d.zip
Qt-74f092408d1a870e2c1e2a49182c8e09f952055d.tar.gz
Qt-74f092408d1a870e2c1e2a49182c8e09f952055d.tar.bz2
Javascript: When there is javascript running then it will spin the CPU at 100%
Zero timers on Windows would continue to fire even after being stopped as long as a new timer was started that reused the pointer address of the zero timer. Fix this by only re-firing zero timers if the zero timer hadn't been stopped (we can check this by looking at the inTimerEvent flag, which is set to false by registerTimer()). Task-number: 247401 Reviewed-by: Denis Dzyubenko Reviewed-by: Prasanth Ullattil
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 880e95c..c4061f4 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -1059,11 +1059,20 @@ bool QEventDispatcherWin32::event(QEvent *e)
QZeroTimerEvent *zte = static_cast<QZeroTimerEvent*>(e);
WinTimerInfo *t = d->timerDict.value(zte->timerId());
if (t) {
+ t->inTimerEvent = true;
+
QTimerEvent te(zte->timerId());
QCoreApplication::sendEvent(t->obj, &te);
- WinTimerInfo *tn = d->timerDict.value(zte->timerId());
- if (tn && t == tn)
- QCoreApplication::postEvent(this, new QZeroTimerEvent(zte->timerId()));
+
+ t = d->timerDict.value(zte->timerId());
+ if (t) {
+ if (t->interval == 0 && t->inTimerEvent) {
+ // post the next zero timer event as long as the timer was not restarted
+ QCoreApplication::postEvent(this, new QZeroTimerEvent(zte->timerId()));
+ }
+
+ t->inTimerEvent = false;
+ }
}
return true;
} else if (e->type() == QEvent::Timer) {