Several member variables were unsafely being accessed from multiple threads. Making these variables std::atomic makes this safe.
Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 2 files). Show all
Unified · Split
| @@ -183,7 +183,7 @@ void ScriptEngine::runInThread() { · 182 unmodified lines | ||
| 183 | 183 | |
| 184 | 184 | QSet<ScriptEngine*> ScriptEngine::_allKnownScriptEngines; |
| 185 | 185 | QMutex ScriptEngine::_allScriptsMutex; |
| 186 | −bool ScriptEngine::_stoppingAllScripts = false; | |
| 186 | +std::atomic<bool> ScriptEngine::_stoppingAllScripts = false; | |
| 187 | 187 | |
| 188 | 188 | void ScriptEngine::stopAllScripts(QObject* application) { |
| 189 | 189 | _allScriptsMutex.lock(); |