mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 15:23:05 +02:00
loading fix
This commit is contained in:
parent
81940214bb
commit
b6744588f4
4 changed files with 12 additions and 10 deletions
|
@ -224,7 +224,7 @@ void EntityTreeRenderer::resetPersistentEntitiesScriptEngine() {
|
||||||
|
|
||||||
void EntityTreeRenderer::resetNonPersistentEntitiesScriptEngine() {
|
void EntityTreeRenderer::resetNonPersistentEntitiesScriptEngine() {
|
||||||
if (_nonPersistentEntitiesScriptEngine) {
|
if (_nonPersistentEntitiesScriptEngine) {
|
||||||
_nonPersistentEntitiesScriptEngine->unloadAllEntityScripts(false);
|
_nonPersistentEntitiesScriptEngine->unloadAllEntityScripts(true);
|
||||||
_nonPersistentEntitiesScriptEngine->stop();
|
_nonPersistentEntitiesScriptEngine->stop();
|
||||||
_nonPersistentEntitiesScriptEngine->waitTillDoneRunning();
|
_nonPersistentEntitiesScriptEngine->waitTillDoneRunning();
|
||||||
_nonPersistentEntitiesScriptEngine->disconnectNonEssentialSignals();
|
_nonPersistentEntitiesScriptEngine->disconnectNonEssentialSignals();
|
||||||
|
|
|
@ -451,7 +451,7 @@ void ScriptEngine::executeOnScriptThread(std::function<void()> function, const Q
|
||||||
function();
|
function();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEngine::waitTillDoneRunning() {
|
void ScriptEngine::waitTillDoneRunning(bool shutdown) {
|
||||||
// Engine should be stopped already, but be defensive
|
// Engine should be stopped already, but be defensive
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
|
@ -520,12 +520,14 @@ void ScriptEngine::waitTillDoneRunning() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: This will be called on the main application thread (among other threads) from stopAllScripts.
|
if (shutdown) {
|
||||||
// The thread will need to continue to process events, because
|
// NOTE: This will be called on the main application thread (among other threads) from stopAllScripts.
|
||||||
// the scripts will likely need to marshall messages across to the main thread, e.g.
|
// The thread will need to continue to process events, because
|
||||||
// if they access Settings or Menu in any of their shutdown code. So:
|
// the scripts will likely need to marshall messages across to the main thread, e.g.
|
||||||
// Process events for this thread, allowing invokeMethod calls to pass between threads.
|
// if they access Settings or Menu in any of their shutdown code. So:
|
||||||
QCoreApplication::processEvents();
|
// Process events for this thread, allowing invokeMethod calls to pass between threads.
|
||||||
|
QCoreApplication::processEvents();
|
||||||
|
}
|
||||||
|
|
||||||
// Avoid a pure busy wait
|
// Avoid a pure busy wait
|
||||||
QThread::yieldCurrentThread();
|
QThread::yieldCurrentThread();
|
||||||
|
|
|
@ -197,7 +197,7 @@ public:
|
||||||
Q_INVOKABLE void stop(bool marshal = false);
|
Q_INVOKABLE void stop(bool marshal = false);
|
||||||
|
|
||||||
// Stop any evaluating scripts and wait for the scripting thread to finish.
|
// Stop any evaluating scripts and wait for the scripting thread to finish.
|
||||||
void waitTillDoneRunning();
|
void waitTillDoneRunning(bool shutdown = false);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// NOTE - these are NOT intended to be public interfaces available to scripts, the are only Q_INVOKABLE so we can
|
// NOTE - these are NOT intended to be public interfaces available to scripts, the are only Q_INVOKABLE so we can
|
||||||
|
|
|
@ -182,7 +182,7 @@ void ScriptEngines::shutdownScripting() {
|
||||||
// want any of the scripts final "scriptEnding()" or pending "update()" methods from accessing
|
// want any of the scripts final "scriptEnding()" or pending "update()" methods from accessing
|
||||||
// any application state after we leave this stopAllScripts() method
|
// any application state after we leave this stopAllScripts() method
|
||||||
qCDebug(scriptengine) << "waiting on script:" << scriptName;
|
qCDebug(scriptengine) << "waiting on script:" << scriptName;
|
||||||
scriptEngine->waitTillDoneRunning();
|
scriptEngine->waitTillDoneRunning(true);
|
||||||
qCDebug(scriptengine) << "done waiting on script:" << scriptName;
|
qCDebug(scriptengine) << "done waiting on script:" << scriptName;
|
||||||
}
|
}
|
||||||
// Once the script is stopped, we can remove it from our set
|
// Once the script is stopped, we can remove it from our set
|
||||||
|
|
Loading…
Reference in a new issue