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