mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
more CR feedback removed redundant abort code
This commit is contained in:
parent
ee4748fee9
commit
00838d1e1e
1 changed files with 0 additions and 25 deletions
|
@ -131,31 +131,6 @@ void ScriptEngines::shutdownScripting() {
|
|||
if (scriptEngine->isRunning()) {
|
||||
qCDebug(scriptengine) << "about to shutdown script:" << scriptName;
|
||||
|
||||
// If the script is running, but still evaluating then we need to wait for its evaluation step to
|
||||
// complete. After that we can handle the stop process appropriately
|
||||
if (scriptEngine->evaluatePending()) {
|
||||
qCDebug(scriptengine) << "script still evaluating:" << scriptName;
|
||||
auto startedWaiting = usecTimestampNow();
|
||||
while (scriptEngine->evaluatePending()) {
|
||||
|
||||
// This event loop allows any started, but not yet finished evaluate() calls to complete
|
||||
// we need to let these complete so that we can be guaranteed that the script engine isn't
|
||||
// in a partially setup state, which can confuse our shutdown unwinding.
|
||||
QEventLoop loop;
|
||||
static const int MAX_PROCESSING_TIME = 500; // in MS
|
||||
loop.processEvents(QEventLoop::AllEvents, MAX_PROCESSING_TIME);
|
||||
auto stillWaiting = usecTimestampNow();
|
||||
auto elapsed = stillWaiting - startedWaiting;
|
||||
// if we've been waiting for more than 5 seconds, then tell the script engine to stop evaluating
|
||||
static const auto WAITING_TOO_LONG = USECS_PER_SECOND * 5;
|
||||
if (elapsed > WAITING_TOO_LONG) {
|
||||
qCDebug(scriptengine) << "giving up on script evaluation elapsed:" << elapsed << "calling abortEvaluation() script:" << scriptName;
|
||||
scriptEngine->abortEvaluation();
|
||||
}
|
||||
}
|
||||
qCDebug(scriptengine) << "script DONE evaluating:" << scriptName;
|
||||
}
|
||||
|
||||
// We disconnect any script engine signals from the application because we don't want to do any
|
||||
// extra stopScript/loadScript processing that the Application normally does when scripts start
|
||||
// and stop. We can safely short circuit this because we know we're in the "quitting" process
|
||||
|
|
Loading…
Reference in a new issue