Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -107,7 +107,6 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam · 106 unmodified lines | ||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | ScriptEngine::~ScriptEngine() { |
| 110 | − qDebug() << "ScriptEngine::~ScriptEngine().... this:" << this << "my thread:" << thread(); | |
| 111 | 110 | // If we're not already in the middle of stopping all scripts, then we should remove ourselves |
| 112 | 111 | // from the list of running scripts. We don't do this if we're in the process of stopping all scripts |
| 113 | 112 | // because that method removes scripts from its list as it iterates them |
| @@ -119,7 +118,7 @@ ScriptEngine::~ScriptEngine() { · 5 unmodified lines | ||
| 119 | 118 | } |
| 120 | 119 | |
| 121 | 120 | void ScriptEngine::runInThread() { |
| 122 | − QThread* workerThread = new QThread(); // thread is owned but ScriptEngine, so if the ScriptEngine is destroyed, the thread will be too. | |
| 121 | + QThread* workerThread = new QThread(); // thread is not owned, so we need to manage the delete | |
| 123 | 122 | QString scriptEngineName = QString("Script Thread:") + getFilename(); |
| 124 | 123 | workerThread->setObjectName(scriptEngineName); |
| 125 | 124 | |
| @@ -132,7 +131,7 @@ void ScriptEngine::runInThread() { · 6 unmodified lines | ||
| 132 | 131 | // when the thread is finished, add thread to the deleteLater queue |
| 133 | 132 | connect(workerThread, &QThread::finished, workerThread, &QThread::deleteLater); |
| 134 | 133 | |
| 135 | − // when the thread is destroyed, add scriptEngine to the deleteLater queue | |
| 134 | + // when the thread is finished, add scriptEngine to the deleteLater queue | |
| 136 | 135 | connect(workerThread, &QThread::finished, this, &ScriptEngine::deleteLater); |
| 137 | 136 | |
| 138 | 137 | moveToThread(workerThread); |