summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-14 02:59:55 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-14 02:59:55 (GMT)
commit078584f79a5f0893d55c893bede61f91b5ccb392 (patch)
tree20136184d38e73d7b88b51f424c5bf8869c0480b
parent5a1a3ab59e96bb5b2968883160564eb24d011859 (diff)
downloadQt-078584f79a5f0893d55c893bede61f91b5ccb392.zip
Qt-078584f79a5f0893d55c893bede61f91b5ccb392.tar.gz
Qt-078584f79a5f0893d55c893bede61f91b5ccb392.tar.bz2
Don't warn on signals emitted after the context has been destroyed
QTBUG-9792
-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"