diff options
Diffstat (limited to 'tests')
3 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativecontext/data/Object_22535.qml b/tests/auto/declarative/qdeclarativecontext/data/Object_22535.qml new file mode 100644 index 0000000000..294c744317 --- /dev/null +++ b/tests/auto/declarative/qdeclarativecontext/data/Object_22535.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + + function goodBye() + { + } +} diff --git a/tests/auto/declarative/qdeclarativecontext/data/qtbug_22535.qml b/tests/auto/declarative/qdeclarativecontext/data/qtbug_22535.qml new file mode 100644 index 0000000000..3553f6c03b --- /dev/null +++ b/tests/auto/declarative/qdeclarativecontext/data/qtbug_22535.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 + +Rectangle { + width: 64 + height: 64 + + Object_22535 { id:o } + + Component.onDestruction: o.goodBye() +} diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp index 68599a2e83..ba9db4f875 100644 --- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp +++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp @@ -80,6 +80,7 @@ private slots: void refreshExpressionsCrash(); void refreshExpressionsRootContext(); + void qtbug_22535(); private: QDeclarativeEngine engine; }; @@ -644,6 +645,18 @@ void tst_qdeclarativecontext::refreshExpressionsRootContext() delete o1; } +void tst_qdeclarativecontext::qtbug_22535() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("qtbug_22535.qml")); + QDeclarativeContext context(engine.rootContext()); + + QObject *o = component.create(&context); + + // Don't crash! + delete o; +} + QTEST_MAIN(tst_qdeclarativecontext) #include "tst_qdeclarativecontext.moc" |