Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -158,6 +158,13 @@ void ScriptEngine::disconnectNonEssentialSignals() { · 157 unmodified lines | ||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | void ScriptEngine::runInThread() { |
| 161 | + Q_ASSERT_X(!_isThreaded, "ScriptEngine::runInThread()", "runInThread should not be called more than once"); | |
| 162 | + | |
| 163 | + if (_isThreaded) { | |
| 164 | + qCWarning(scriptengine) << "ScriptEngine already running in thread: " << getFilename(); | |
| 165 | + return; | |
| 166 | + } | |
| 167 | + | |
| 161 | 168 | _isThreaded = true; |
| 162 | 169 | QThread* workerThread = new QThread(); // thread is not owned, so we need to manage the delete |
| 163 | 170 | QString scriptEngineName = QString("Script Thread:") + getFilename(); |