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 | void ScriptEngine::timerFired() { | 606 | void ScriptEngine::timerFired() { |
| 607 | QTimer* callingTimer = reinterpret_cast<QTimer*>(sender()); | 607 | QTimer* callingTimer = reinterpret_cast<QTimer*>(sender()); |
| 608 | |||
| 609 | // call the associated JS function, if it exists | ||
| 610 | QScriptValue timerFunction = _timerFunctionMap.value(callingTimer); | 608 | QScriptValue timerFunction = _timerFunctionMap.value(callingTimer); |
| 611 | if (timerFunction.isValid()) { | 609 | |
| 612 | timerFunction.call(); | ||
| 613 | } | ||
| 614 | |||
| 615 | if (!callingTimer->isActive()) { | 610 | if (!callingTimer->isActive()) { |
| 616 | // this timer is done, we can kill it | 611 | // this timer is done, we can kill it |
| 617 | _timerFunctionMap.remove(callingTimer); | 612 | _timerFunctionMap.remove(callingTimer); |
| 618 | delete callingTimer; | 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 | QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int intervalMS, bool isSingleShot) { | 622 | QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int intervalMS, bool isSingleShot) { |