more CR feedback removed redundant abort code

This commit is contained in:
ZappoMan 2016-04-30 15:38:37 -07:00
parent ee4748fee9
commit 00838d1e1e

View file

@ -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