History

set isStopping on other calls to stop

Seth Alves committed 10 years ago

Commit 3f5ed4b1 parent 9ad488b1 file · +2 −2Browse 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+2−2
@@ -160,6 +160,7 @@ void ScriptEngines::shutdownScripting() { · 159 unmodified lines
160 scriptEngine->disconnect(this);160 scriptEngine->disconnect(this);
161 161
162 // Gracefully stop the engine's scripting thread162 // Gracefully stop the engine's scripting thread
163 scriptEngine->setIsStopping();
163 scriptEngine->stop();164 scriptEngine->stop();
164 165
165 // We need to wait for the engine to be done running before we proceed, because we don't166 // We need to wait for the engine to be done running before we proceed, because we don't
@@ -353,7 +354,6 @@ void ScriptEngines::stopAllScripts(bool restart) { · 187 unmodified lines
353 }354 }
354 it.value()->setIsStopping();355 it.value()->setIsStopping();
355 QMetaObject::invokeMethod(it.value(), "stop");356 QMetaObject::invokeMethod(it.value(), "stop");
356 //it.value()->stop();
357 qCDebug(scriptengine) << "stopping script..." << it.key();357 qCDebug(scriptengine) << "stopping script..." << it.key();
358 }358 }
359}359}
@@ -370,13 +370,13 @@ bool ScriptEngines::stopScript(const QString& rawScriptURL, bool restart) { · 10 unmodified lines
370 if (_scriptEnginesHash.contains(scriptURL)) {370 if (_scriptEnginesHash.contains(scriptURL)) {
371 ScriptEngine* scriptEngine = _scriptEnginesHash[scriptURL];371 ScriptEngine* scriptEngine = _scriptEnginesHash[scriptURL];
372 if (restart) {372 if (restart) {
373 scriptEngine->setIsStopping();
374 auto scriptCache = DependencyManager::get<ScriptCache>();373 auto scriptCache = DependencyManager::get<ScriptCache>();
375 scriptCache->deleteScript(scriptURL);374 scriptCache->deleteScript(scriptURL);
376 connect(scriptEngine, &ScriptEngine::finished, this, [this](QString scriptName, ScriptEngine* engine) {375 connect(scriptEngine, &ScriptEngine::finished, this, [this](QString scriptName, ScriptEngine* engine) {
377 reloadScript(scriptName);376 reloadScript(scriptName);
378 });377 });
379 }378 }
379 scriptEngine->setIsStopping();
380 scriptEngine->stop();380 scriptEngine->stop();
381 stoppedScript = true;381 stoppedScript = true;
382 qCDebug(scriptengine) << "stopping script..." << scriptURL;382 qCDebug(scriptengine) << "stopping script..." << scriptURL;