aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-11-17 15:27:04 +0000
committerQt by Nokia <qt-info@nokia.com>2011-11-17 16:53:24 +0100
commit16316391948b09c7249b5094493eeef6b869d9bc (patch)
tree0f95ae887392657f80324355b3be0e2d69646be8 /tests
parent1bc5117533b09548f7b669a47ae4657b2d22f561 (diff)
Fix crash in incubator when a guarded context is deleted
Change-Id: Ice7375c344b7e8d0d11cc6ee0bdfdf864ecd7109 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeincubator/data/contextDelete.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp20
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeincubator/data/contextDelete.qml b/tests/auto/declarative/qdeclarativeincubator/data/contextDelete.qml
new file mode 100644
index 0000000000..c3952074f1
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeincubator/data/contextDelete.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int dummy: 12
+}
diff --git a/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp b/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp
index 54ca622753..efa46264c3 100644
--- a/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp
+++ b/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp
@@ -47,6 +47,7 @@
#include <QPointer>
#include <QFileInfo>
#include <QDeclarativeEngine>
+#include <QDeclarativeContext>
#include <QDeclarativeProperty>
#include <QDeclarativeComponent>
#include <QDeclarativeIncubator>
@@ -85,6 +86,7 @@ private slots:
void chainedAsynchronousIfNested();
void chainedAsynchronousIfNestedOnCompleted();
void selfDelete();
+ void contextDelete();
private:
QDeclarativeIncubationController controller;
@@ -975,6 +977,24 @@ void tst_qdeclarativeincubator::selfDelete()
}
}
+// Test that QML doesn't crash if the context is deleted prior to the incubator
+// first executing.
+void tst_qdeclarativeincubator::contextDelete()
+{
+ QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext());
+ QDeclarativeComponent component(&engine, TEST_FILE("contextDelete.qml"));
+
+ QDeclarativeIncubator incubator;
+ component.create(incubator, context);
+
+ delete context;
+
+ {
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+}
+
QTEST_MAIN(tst_qdeclarativeincubator)
#include "tst_qdeclarativeincubator.moc"