From 7695afec0af14260393214fbb797a47fd7c540e3 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Wed, 28 Oct 2015 16:42:17 -0700 Subject: [PATCH 1/2] Fix ScriptEngine crash --- libraries/script-engine/src/ScriptEngine.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 1d6bf32fcc..39f0963112 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -685,9 +685,8 @@ void ScriptEngine::run() { } lastUpdate = now; - if (hadUncauchtExceptions(*this, _fileNameString)) { - stop(); - } + // Debug and clear exceptions + hadUncauchtExceptions(*this, _fileNameString); } stopAllTimers(); // make sure all our timers are stopped if the script is ending From 136747929e76cf2e449b13f3e29e3bab75b78bba Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Wed, 28 Oct 2015 17:11:46 -0700 Subject: [PATCH 2/2] Fix typo --- libraries/script-engine/src/ScriptEngine.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 39f0963112..b416b58910 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -96,7 +96,7 @@ static bool hasCorrectSyntax(const QScriptProgram& program) { return true; } -static bool hadUncauchtExceptions(QScriptEngine& engine, const QString& fileName) { +static bool hadUncaughtExceptions(QScriptEngine& engine, const QString& fileName) { if (engine.hasUncaughtException()) { const auto backtrace = engine.uncaughtExceptionBacktrace(); const auto exception = engine.uncaughtException().toString(); @@ -616,7 +616,7 @@ QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fi const auto result = QScriptEngine::evaluate(program); --_evaluatesPending; - const auto hadUncaughtException = hadUncauchtExceptions(*this, program.fileName()); + const auto hadUncaughtException = hadUncaughtExceptions(*this, program.fileName()); if (_wantSignals) { emit evaluationFinished(result, hadUncaughtException); } @@ -686,7 +686,7 @@ void ScriptEngine::run() { lastUpdate = now; // Debug and clear exceptions - hadUncauchtExceptions(*this, _fileNameString); + hadUncaughtExceptions(*this, _fileNameString); } stopAllTimers(); // make sure all our timers are stopped if the script is ending @@ -1021,7 +1021,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co QScriptEngine sandbox; QScriptValue testConstructor = sandbox.evaluate(program); - if (hadUncauchtExceptions(sandbox, program.fileName())) { + if (hadUncaughtExceptions(sandbox, program.fileName())) { return; }