Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -605,18 +605,18 @@ void ScriptEngine::stop() { · 604 unmodified lines | ||
| 605 | 605 | |
| 606 | 606 | void ScriptEngine::timerFired() { |
| 607 | 607 | QTimer* callingTimer = reinterpret_cast<QTimer*>(sender()); |
| 608 | − | |
| 609 | − // call the associated JS function, if it exists | |
| 610 | 608 | QScriptValue timerFunction = _timerFunctionMap.value(callingTimer); |
| 611 | − if (timerFunction.isValid()) { | |
| 612 | − timerFunction.call(); | |
| 613 | − } | |
| 614 | − | |
| 609 | + | |
| 615 | 610 | if (!callingTimer->isActive()) { |
| 616 | 611 | // this timer is done, we can kill it |
| 617 | 612 | _timerFunctionMap.remove(callingTimer); |
| 618 | 613 | delete callingTimer; |
| 619 | 614 | } |
| 615 | + | |
| 616 | + // call the associated JS function, if it exists | |
| 617 | + if (timerFunction.isValid()) { | |
| 618 | + timerFunction.call(); | |
| 619 | + } | |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int intervalMS, bool isSingleShot) { |