Showing the changes to libraries/script-engine/src/ScriptEngines.cpp (1 of 28 files). Show all
Unified · Split
| @@ -363,6 +363,13 @@ QStringList ScriptEngines::getRunningScripts() { · 362 unmodified lines | |||
| 363 | void ScriptEngines::stopAllScripts(bool restart) { | 363 | void ScriptEngines::stopAllScripts(bool restart) { |
| 364 | QVector<QString> toReload; | 364 | QVector<QString> toReload; |
| 365 | QReadLocker lock(&_scriptEnginesHashLock); | 365 | QReadLocker lock(&_scriptEnginesHashLock); |
| 366 | |||
| 367 | if (_isReloading) { | ||
| 368 | return; | ||
| 369 | } else { | ||
| 370 | _isReloading = true; | ||
| 371 | } | ||
| 372 | |||
| 366 | for (QHash<QUrl, ScriptEngine*>::const_iterator it = _scriptEnginesHash.constBegin(); | 373 | for (QHash<QUrl, ScriptEngine*>::const_iterator it = _scriptEnginesHash.constBegin(); |
| 367 | it != _scriptEnginesHash.constEnd(); it++) { | 374 | it != _scriptEnginesHash.constEnd(); it++) { |
| 368 | ScriptEngine *scriptEngine = it.value(); | 375 | ScriptEngine *scriptEngine = it.value(); |
| @@ -382,7 +389,7 @@ void ScriptEngines::stopAllScripts(bool restart) { · 13 unmodified lines | |||
| 382 | } | 389 | } |
| 383 | // wait for engines to stop (ie: providing time for .scriptEnding cleanup handlers to run) before | 390 | // wait for engines to stop (ie: providing time for .scriptEnding cleanup handlers to run) before |
| 384 | // triggering reload of any Client scripts / Entity scripts | 391 | // triggering reload of any Client scripts / Entity scripts |
| 385 | QTimer::singleShot(500, this, [=]() { | 392 | QTimer::singleShot(1000, this, [=]() { |
| 386 | for(const auto &scriptName : toReload) { | 393 | for(const auto &scriptName : toReload) { |
| 387 | auto scriptEngine = getScriptEngine(scriptName); | 394 | auto scriptEngine = getScriptEngine(scriptName); |
| 388 | if (scriptEngine && !scriptEngine->isFinished()) { | 395 | if (scriptEngine && !scriptEngine->isFinished()) { |
| @@ -397,6 +404,7 @@ void ScriptEngines::stopAllScripts(bool restart) { · 8 unmodified lines | |||
| 397 | qCDebug(scriptengine) << "stopAllScripts -- emitting scriptsReloading"; | 404 | qCDebug(scriptengine) << "stopAllScripts -- emitting scriptsReloading"; |
| 398 | emit scriptsReloading(); | 405 | emit scriptsReloading(); |
| 399 | } | 406 | } |
| 407 | _isReloading = false; | ||
| 400 | }); | 408 | }); |
| 401 | } | 409 | } |
| 402 | 410 | ||