Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 6 files). Show all
Unified · Split
| @@ -290,7 +290,7 @@ void ScriptEngine::waitTillDoneRunning() { · 289 unmodified lines | |||
| 290 | assert(workerThread != QThread::currentThread()); | 290 | assert(workerThread != QThread::currentThread()); |
| 291 | 291 | ||
| 292 | // Engine should be stopped already, but be defensive | 292 | // Engine should be stopped already, but be defensive |
| 293 | stop(); | 293 | stop(false); |
| 294 | 294 | ||
| 295 | auto startedWaiting = usecTimestampNow(); | 295 | auto startedWaiting = usecTimestampNow(); |
| 296 | while (workerThread->isRunning()) { | 296 | while (workerThread->isRunning()) { |
| @@ -941,13 +941,15 @@ void ScriptEngine::stopAllTimersForEntityScript(const EntityItemID& entityID) { · 644 unmodified lines | |||
| 941 | 941 | ||
| 942 | } | 942 | } |
| 943 | 943 | ||
| 944 | void ScriptEngine::stop() { | 944 | void ScriptEngine::stop(bool marshal) { |
| 945 | _isStopping = true; // this can be done on any thread | 945 | _isStopping = true; // this can be done on any thread |
| 946 | 946 | ||
| 947 | // marshal us over to the correct thread | 947 | // marshal us over to the correct thread |
| 948 | if (QThread::currentThread() != thread()) { | 948 | if (marshal) { |
| 949 | QMetaObject::invokeMethod(this, "stop"); | 949 | if (QThread::currentThread() != thread()) { |
| 950 | return; | 950 | QMetaObject::invokeMethod(this, "stop"); |
| 951 | return; | ||
| 952 | } | ||
| 951 | } | 953 | } |
| 952 | if (!_isFinished) { | 954 | if (!_isFinished) { |
| 953 | _isFinished = true; | 955 | _isFinished = true; |