History

Fix entity script event crash, script restart and shutdown crashes

ksuprynowicz committed 5 months ago

Commit 780d8721 parent 3198fca2 files · +99 −25Browse files

Showing the changes to libraries/script-engine/src/ScriptManager.cpp (1 of 2 files). Show all

Unified · Split

libraries/script-engine/src/ScriptManager.cpp+7−0
@@ -550,6 +550,8 @@ void ScriptManager::waitTillDoneRunning(bool shutdown) { · 549 unmodified lines
550 // if they access Settings or Menu in any of their shutdown code. So:550 // if they access Settings or Menu in any of their shutdown code. So:
551 // Process events for this thread, allowing invokeMethod calls to pass between threads.551 // Process events for this thread, allowing invokeMethod calls to pass between threads.
552 QCoreApplication::processEvents();552 QCoreApplication::processEvents();
553 // Events may use script engine so guard is necessary.
554 auto scopeGuard = _engine->getScopeGuard();
553 _engine->processEvents();555 _engine->processEvents();
554 }556 }
555 557
@@ -1224,6 +1226,11 @@ void ScriptManager::timerFired() { · 668 unmodified lines
1224 return; // bail early1226 return; // bail early
1225 }1227 }
1226 1228
1229 // Timer events shouldn't be processed after the script engine has shut down.
1230 if (_isDoneRunning) {
1231 return;
1232 }
1233
1227//#define SCRIPT_TIMER_PERFORMANCE_STATISTICS1234//#define SCRIPT_TIMER_PERFORMANCE_STATISTICS
1228#ifdef SCRIPT_TIMER_PERFORMANCE_STATISTICS1235#ifdef SCRIPT_TIMER_PERFORMANCE_STATISTICS
1229 _timerCallCounter++;1236 _timerCallCounter++;