diff options
author | Renato Araujo Oliveira Filho <renato.filho@canonical.com> | 2012-10-16 07:56:41 +0000 |
---|---|---|
committer | Tarmac <> | 2012-10-16 07:56:41 +0000 |
commit | 340e67d86483b2038d087b6ff2615e0d5c7cc5cc (patch) | |
tree | 5043b5daf97aa9e2bb2e87e7d5809b3a762e556e /tests/client/loadmodel.qml | |
parent | 5999e7a42962140b6479995d77a178186b6b2fcc (diff) | |
parent | 5c56d1288ba905ab162246c65fffbc69a831a14e (diff) | |
download | qmenumodel-340e67d86483b2038d087b6ff2615e0d5c7cc5cc.tar.gz qmenumodel-340e67d86483b2038d087b6ff2615e0d5c7cc5cc.tar.bz2 qmenumodel-340e67d86483b2038d087b6ff2615e0d5c7cc5cc.zip |
Avoid emit model reset during QMenuModel destructor, to avoid crash in QML engine.. Approved by Olivier Tilloy, PS Jenkins bot, jenkins.
Diffstat (limited to 'tests/client/loadmodel.qml')
-rw-r--r-- | tests/client/loadmodel.qml | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/client/loadmodel.qml b/tests/client/loadmodel.qml new file mode 100644 index 0000000..7a1f045 --- /dev/null +++ b/tests/client/loadmodel.qml @@ -0,0 +1,33 @@ +import QtQuick 2.0 +import QMenuModel 0.1 + +Item { + id: root + width: 100 + height: 100 + + property bool reset: resetModel + + onResetChanged: { + if (reset) { + // destroy the current model and check if it will not crash the QML engine + view.model.destroy(); + } + } + + ListView { + id: view + anchors.fill: parent + delegate: Text { + text: label + } + } + + Component.onCompleted: { + // dynamically create the model to destroy it later + var model = Qt.createQmlObject("import QMenuModel 0.1; QDBusMenuModel { id: menuModel; busType: globalBusType; busName: globalBusName; objectPath: globalObjectPath; }", view, ""); + model.start(); + view.model = model; + } +} + |