mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 10:58:22 +02:00
handle possibly deleted ScriptEngine in getScriptContents
This commit is contained in:
parent
87078b1ea2
commit
71d57295eb
1 changed files with 10 additions and 2 deletions
|
@ -1077,13 +1077,21 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString&
|
||||||
qDebug() << "ScriptEngine::loadEntityScript() calling scriptCache->getScriptContents() on thread ["
|
qDebug() << "ScriptEngine::loadEntityScript() calling scriptCache->getScriptContents() on thread ["
|
||||||
<< QThread::currentThread() << "] expected thread [" << thread() << "]";
|
<< QThread::currentThread() << "] expected thread [" << thread() << "]";
|
||||||
#endif
|
#endif
|
||||||
DependencyManager::get<ScriptCache>()->getScriptContents(entityScript, [=](const QString& scriptOrURL, const QString& contents, bool isURL, bool success) {
|
|
||||||
|
QPointer<ScriptEngine> theEngine(this);
|
||||||
|
|
||||||
|
DependencyManager::get<ScriptCache>()->getScriptContents(entityScript, [theEngine, entityID](const QString& scriptOrURL, const QString& contents, bool isURL, bool success) {
|
||||||
#ifdef THREAD_DEBUGGING
|
#ifdef THREAD_DEBUGGING
|
||||||
qDebug() << "ScriptEngine::entityScriptContentAvailable() IN LAMBDA contentAvailable on thread ["
|
qDebug() << "ScriptEngine::entityScriptContentAvailable() IN LAMBDA contentAvailable on thread ["
|
||||||
<< QThread::currentThread() << "] expected thread [" << thread() << "]";
|
<< QThread::currentThread() << "] expected thread [" << thread() << "]";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this->entityScriptContentAvailable(entityID, scriptOrURL, contents, isURL, success);
|
if (!theEngine.isNull()) {
|
||||||
|
qDebug() << "ScriptCache::getScriptContents() returned ScriptEngine still active calling ... entityScriptContentAvailable()";
|
||||||
|
theEngine->entityScriptContentAvailable(entityID, scriptOrURL, contents, isURL, success);
|
||||||
|
} else {
|
||||||
|
qDebug() << "ScriptCache::getScriptContents() returned after our ScriptEngine was deleted...";
|
||||||
|
}
|
||||||
}, forceRedownload);
|
}, forceRedownload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue