The thread appeared to be deleted before waitTillDoneRunning was finished. This is a speculative fix. This ensures that the QThread isn't deleted until after the ScriptEngine is deleted.
Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -231,7 +231,7 @@ void ScriptEngine::disconnectNonEssentialSignals() { · 230 unmodified lines | ||
| 231 | 231 | // Ensure the thread should be running, and does exist |
| 232 | 232 | if (_isRunning && _isThreaded && (workerThread = thread())) { |
| 233 | 233 | connect(this, &ScriptEngine::doneRunning, workerThread, &QThread::quit); |
| 234 | − connect(workerThread, &QThread::finished, workerThread, &QObject::deleteLater); | |
| 234 | + connect(this, &QObject::destroyed, workerThread, &QObject::deleteLater); | |
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
| @@ -346,7 +346,7 @@ void ScriptEngine::runInThread() { · 108 unmodified lines | ||
| 346 | 346 | // disconnectNonEssentialSignals() method |
| 347 | 347 | connect(workerThread, &QThread::started, this, &ScriptEngine::run); |
| 348 | 348 | connect(this, &ScriptEngine::doneRunning, workerThread, &QThread::quit); |
| 349 | − connect(workerThread, &QThread::finished, workerThread, &QObject::deleteLater); | |
| 349 | + connect(this, &QObject::destroyed, workerThread, &QObject::deleteLater); | |
| 350 | 350 | |
| 351 | 351 | workerThread->start(); |
| 352 | 352 | } |