mirror of
https://github.com/lubosz/overte.git
synced 2025-04-14 02:06:15 +02:00
Fix ScriptEngine thread being deleted too early
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.
This commit is contained in:
parent
bfb44693a3
commit
09c98b3ac3
1 changed files with 2 additions and 2 deletions
|
@ -231,7 +231,7 @@ void ScriptEngine::disconnectNonEssentialSignals() {
|
|||
// Ensure the thread should be running, and does exist
|
||||
if (_isRunning && _isThreaded && (workerThread = thread())) {
|
||||
connect(this, &ScriptEngine::doneRunning, workerThread, &QThread::quit);
|
||||
connect(workerThread, &QThread::finished, workerThread, &QObject::deleteLater);
|
||||
connect(this, &QObject::destroyed, workerThread, &QObject::deleteLater);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ void ScriptEngine::runInThread() {
|
|||
// disconnectNonEssentialSignals() method
|
||||
connect(workerThread, &QThread::started, this, &ScriptEngine::run);
|
||||
connect(this, &ScriptEngine::doneRunning, workerThread, &QThread::quit);
|
||||
connect(workerThread, &QThread::finished, workerThread, &QObject::deleteLater);
|
||||
connect(this, &QObject::destroyed, workerThread, &QObject::deleteLater);
|
||||
|
||||
workerThread->start();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue