mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-31 01:01:32 +02:00
Add protection around ScriptEngine::runInThread being called twice
This commit is contained in:
parent
6b3a4eb327
commit
1a2f74f43a
1 changed files with 7 additions and 0 deletions
|
@ -158,6 +158,13 @@ void ScriptEngine::disconnectNonEssentialSignals() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEngine::runInThread() {
|
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;
|
_isThreaded = true;
|
||||||
QThread* workerThread = new QThread(); // thread is not owned, so we need to manage the delete
|
QThread* workerThread = new QThread(); // thread is not owned, so we need to manage the delete
|
||||||
QString scriptEngineName = QString("Script Thread:") + getFilename();
|
QString scriptEngineName = QString("Script Thread:") + getFilename();
|
||||||
|
|
Loading…
Reference in a new issue