Merge pull request #7427 from huffman/fix-scriptengine-threading

Add protection around ScriptEngine::runInThread being called twice
This commit is contained in:
Brad Hefta-Gaub 2016-03-23 10:27:16 -07:00
commit 2e6c360708

View file

@ -158,6 +158,13 @@ void ScriptEngine::disconnectNonEssentialSignals() {
}
void ScriptEngine::runInThread() {
Q_ASSERT_X(!_isThreaded, "ScriptEngine::runInThread()", "runInThread should not be called more than once");
if (_isThreaded) {
qCWarning(scriptengine) << "ScriptEngine already running in thread: " << getFilename();
return;
}
_isThreaded = true;
QThread* workerThread = new QThread(); // thread is not owned, so we need to manage the delete
QString scriptEngineName = QString("Script Thread:") + getFilename();