summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/qml/qdeclarativeboundsignal.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp27
2 files changed, 28 insertions, 1 deletions
diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp
index 762c6428..8c7a977 100644
--- a/src/declarative/qml/qdeclarativeboundsignal.cpp
+++ b/src/declarative/qml/qdeclarativeboundsignal.cpp
@@ -176,7 +176,7 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a)
}
if (m_params) m_params->setValues(a);
- if (m_expression) {
+ if (m_expression && m_expression->engine()) {
QDeclarativeExpressionPrivate::get(m_expression)->value(m_params);
if (m_expression && m_expression->hasError())
qWarning().nospace() << qPrintable(m_expression->error().toString());
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index c9fb116..c648de4 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -141,6 +141,7 @@ private slots:
void deletedEngine();
void libraryScriptAssert();
void variantsAssignedUndefined();
+ void qtbug_9792();
void callQtInvokables();
private:
@@ -2211,6 +2212,32 @@ void tst_qdeclarativeecmascript::variantsAssignedUndefined()
delete object;
}
+void tst_qdeclarativeecmascript::qtbug_9792()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("qtbug_9792.qml"));
+
+ QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext());
+
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create(context));
+ QVERIFY(object != 0);
+
+ QTest::ignoreMessage(QtDebugMsg, "Hello world!");
+ object->basicSignal();
+
+ delete context;
+
+ transientErrorsMsgCount = 0;
+ QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler);
+
+ object->basicSignal();
+
+ qInstallMsgHandler(old);
+
+ QCOMPARE(transientErrorsMsgCount, 0);
+
+ delete object;
+}
+
QTEST_MAIN(tst_qdeclarativeecmascript)
#include "tst_qdeclarativeecmascript.moc"