diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-05-22 23:10:01 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2013-05-23 13:12:16 +0200 |
commit | d59a5dd02ab02fcaf21fc87a95ecbb57c8b8c86c (patch) | |
tree | b684128fc65d53bab7df8c2ad8f95b12a7944052 /src/qml/qml/qqmlvme.cpp | |
parent | 6dee93c6492de34cb18f57e73d2b2044fa1a4396 (diff) |
Fix crash in tst_qqmlecmascript::qtbug_22843()
Parse errors throw exceptions, which we must catch here. The caller will
check !m_program and return accordingly. This restores the previous
behavior also found in stable/dev.
Change-Id: Iecff94858ba12f13e581ec1664a092b3e9cd963d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlvme.cpp')
-rw-r--r-- | src/qml/qml/qqmlvme.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index d291452b49..f3220962eb 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -1165,15 +1165,17 @@ void QQmlScriptData::initialize(QQmlEngine *engine) QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine); QV8Engine *v8engine = ep->v8engine(); QV4::ExecutionEngine *v4 = QV8Engine::getV4(v8engine); + QV4::ExecutionContext *ctx = v4->current; // If compilation throws an error, a surrounding catch will record it. // pass 0 as the QML object, we set it later before calling run() QV4::Script *program = new QV4::Script(v4, 0, m_programSource, urlString, 1); try { program->parse(); - } catch (QV4::Exception &) { + } catch (QV4::Exception &e) { + e.accept(ctx); delete program; - throw; + return; } m_program = program; |