Showing the changes to libraries/script-engine/src/ScriptEngines.cpp (1 of 12 files). Show all
Unified · Split
| @@ -427,11 +427,13 @@ bool ScriptEngines::stopScript(const QString& rawScriptURL, bool restart) { · 426 unmodified lines | |||
| 427 | if (_scriptEnginesHash.contains(scriptURL)) { | 427 | if (_scriptEnginesHash.contains(scriptURL)) { |
| 428 | ScriptEnginePointer scriptEngine = _scriptEnginesHash[scriptURL]; | 428 | ScriptEnginePointer scriptEngine = _scriptEnginesHash[scriptURL]; |
| 429 | if (restart) { | 429 | if (restart) { |
| 430 | bool isUserLoaded = scriptEngine->isUserLoaded(); | ||
| 431 | ScriptEngine::Type type = scriptEngine->getType(); | ||
| 430 | auto scriptCache = DependencyManager::get<ScriptCache>(); | 432 | auto scriptCache = DependencyManager::get<ScriptCache>(); |
| 431 | scriptCache->deleteScript(scriptURL); | 433 | scriptCache->deleteScript(scriptURL); |
| 432 | connect(scriptEngine.data(), &ScriptEngine::finished, | 434 | connect(scriptEngine.data(), &ScriptEngine::finished, |
| 433 | this, [this](QString scriptName, ScriptEnginePointer engine) { | 435 | this, [this, isUserLoaded, type](QString scriptName, ScriptEnginePointer engine) { |
| 434 | reloadScript(scriptName); | 436 | reloadScript(scriptName, isUserLoaded)->setType(type); |
| 435 | }); | 437 | }); |
| 436 | } | 438 | } |
| 437 | scriptEngine->stop(); | 439 | scriptEngine->stop(); |