History

better shutdown check for timer firings

howard-stearns committed 10 years ago

Commit c806f6c1 parent 41e90ed1 file · +6 −3Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+6−3
@@ -1017,9 +1017,12 @@ void ScriptEngine::updateMemoryCost(const qint64& deltaSize) { · 1016 unmodified lines
10171017 }
10181018
10191019 void ScriptEngine::timerFired() {
1020− if (DependencyManager::get<ScriptEngines>()->isStopped()) {
1021− qCDebug(scriptengine) << "Script.timerFired() while shutting down is ignored... parent script:" << getFilename();
1022− return; // bail early
1020+ {
1021+ auto engine = DependencyManager::get<ScriptEngines>();
1022+ if (!engine || engine->isStopped()) {
1023+ qCDebug(scriptengine) << "Script.timerFired() while shutting down is ignored... parent script:" << getFilename();
1024+ return; // bail early
1025+ }
10231026 }
10241027
10251028 QTimer* callingTimer = reinterpret_cast<QTimer*>(sender());