Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -154,8 +154,10 @@ ScriptEngine::~ScriptEngine() { · 153 unmodified lines | ||
| 154 | 154 | |
| 155 | 155 | void ScriptEngine::disconnectNonEssentialSignals() { |
| 156 | 156 | disconnect(); |
| 157 | − if (_isRunning && _isThreaded) { // ensure the thread is running | |
| 158 | − connect(this, &ScriptEngine::doneRunning, thread(), &QThread::quit); | |
| 157 | + QThread* receiver; | |
| 158 | + // Ensure the thread should be running, and does exist | |
| 159 | + if (_isRunning && _isThreaded && (receiver = thread())) { | |
| 160 | + connect(this, &ScriptEngine::doneRunning, receiver, &QThread::quit); | |
| 159 | 161 | } |
| 160 | 162 | } |
| 161 | 163 | |