diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-10-01 13:47:09 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-10-01 14:02:22 (GMT) |
commit | 8d920689a704be771488d2aae61b69077a7a491f (patch) | |
tree | 73ec502d1cde02dc9758454e26b8e7b7489fa8c2 /src/script/api | |
parent | e247c880800c15914fb12679fe65949034f77403 (diff) | |
download | Qt-8d920689a704be771488d2aae61b69077a7a491f.zip Qt-8d920689a704be771488d2aae61b69077a7a491f.tar.gz Qt-8d920689a704be771488d2aae61b69077a7a491f.tar.bz2 |
Reset timeout-checker before evaluating when processEventsInterval is used
When the timeout-checker was not reset, it could take a while
(e.g. 1-2 seconds) before the next timeout occurred, depending on
what the tick counter happened to be after the previous evaluate().
When a processEventsInterval of e.g. 100 milliseconds has been
specified, we want the timeout to happen much sooner, thus we need
to reset the checker. This will cause the first timeout to happen
quickly, and then at steady intervals (processEventsInterval ms)
after that.
The tst_QScriptEngine::processEventsWhileRunning() test was
sporadically failing due to this issue.
Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script/api')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 059b102..fb14940 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -2185,6 +2185,8 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file JSC::JSObject* thisObject = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec); JSC::JSValue exceptionValue; d->timeoutChecker()->setShouldAbort(false); + if (d->processEventsInterval > 0) + d->timeoutChecker()->reset(); JSC::JSValue result = exec->interpreter()->execute(&executable, exec, thisObject, exec->scopeChain(), &exceptionValue); if (d->timeoutChecker()->shouldAbort()) { |