History

prevent have more than one instance of a script after reloading script

Dante Ruiz committed 8 years ago

Commit 8b4b95f1 parent 4f561b01 file · +7 −4Browse files

Showing the changes to libraries/script-engine/src/ScriptEngines.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptEngines.cpp+7−4
@@ -432,10 +432,13 @@ bool ScriptEngines::stopScript(const QString& rawScriptURL, bool restart) { · 431 unmodified lines
432 ScriptEngine::Type type = scriptEngine->getType();432 ScriptEngine::Type type = scriptEngine->getType();
433 auto scriptCache = DependencyManager::get<ScriptCache>();433 auto scriptCache = DependencyManager::get<ScriptCache>();
434 scriptCache->deleteScript(scriptURL);434 scriptCache->deleteScript(scriptURL);
435 connect(scriptEngine.data(), &ScriptEngine::finished,435
436 this, [this, isUserLoaded, type](QString scriptName, ScriptEnginePointer engine) {436 if (!scriptEngine->isStopping()) {
437 reloadScript(scriptName, isUserLoaded)->setType(type);437 connect(scriptEngine.data(), &ScriptEngine::finished,
438 });438 this, [this, isUserLoaded, type](QString scriptName, ScriptEnginePointer engine) {
439 reloadScript(scriptName, isUserLoaded)->setType(type);
440 });
441 }
439 }442 }
440 scriptEngine->stop();443 scriptEngine->stop();
441 stoppedScript = true;444 stoppedScript = true;