Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 3 files). Show all
Unified · Split
| @@ -938,6 +938,13 @@ void ScriptEngine::stopAllTimersForEntityScript(const EntityItemID& entityID) { · 937 unmodified lines | ||
| 938 | 938 | } |
| 939 | 939 | |
| 940 | 940 | void ScriptEngine::stop() { |
| 941 | + _isStopping = true; // this can be done on any thread | |
| 942 | + | |
| 943 | + // marshal us over to the correct thread | |
| 944 | + if (QThread::currentThread() != thread()) { | |
| 945 | + QMetaObject::invokeMethod(this, "stop"); | |
| 946 | + return; | |
| 947 | + } | |
| 941 | 948 | if (!_isFinished) { |
| 942 | 949 | _isFinished = true; |
| 943 | 950 | emit runningStateChanged(); |