diff options
-rw-r--r-- | src/script/bridge/qscriptqobject.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qscriptqobject/tst_qscriptqobject.cpp | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index d903efd..43c97aa 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -1248,11 +1248,12 @@ void QObjectDelegate::put(QScriptObject *object, JSC::ExecState* exec, JSC::JSValue value, JSC::PutPropertySlot &slot) { QByteArray name = qtStringFromJSCUString(propertyName.ustring()).toLatin1(); + QScriptEnginePrivate *const eng = static_cast<QScript::GlobalObject*>(exec->lexicalGlobalObject())->engine; QObject *qobject = data->value; if (!qobject) { QString message = QString::fromLatin1("cannot access member `%0' of deleted QObject") .arg(QString::fromLatin1(name)); - JSC::throwError(exec, JSC::GeneralError, qtStringToJSCUString(message)); + eng->uncaughtException = JSC::throwError(exec, JSC::GeneralError, qtStringToJSCUString(message)); return; } diff --git a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp index c456f1c..acabd4d 100644 --- a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp +++ b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp @@ -2839,11 +2839,8 @@ void tst_QScriptExtQObject::objectDeleted() eng.evaluate("Object"); QVERIFY(!eng.hasUncaughtException()); v.setProperty("objectName", QScriptValue(&eng, "foo")); - QEXPECT_FAIL("", "Attempt to set property of deleted QObject should throw error", Continue); QVERIFY(eng.hasUncaughtException()); - QEXPECT_FAIL("", "Attempt to set property of deleted QObject should throw error", Continue); QVERIFY(eng.uncaughtException().isError()); - QEXPECT_FAIL("", "Attempt to set property of deleted QObject should throw error", Continue); QCOMPARE(eng.uncaughtException().toString(), QLatin1String("Error: cannot access member `objectName' of deleted QObject")); } |