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/modeltest.cpp | |
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/modeltest.cpp')
-rw-r--r-- | tests/client/modeltest.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/client/modeltest.cpp b/tests/client/modeltest.cpp index 9f6ee76..03629ca 100644 --- a/tests/client/modeltest.cpp +++ b/tests/client/modeltest.cpp @@ -204,6 +204,28 @@ private Q_SLOTS: QCOMPARE(v.toString(), QString("42")); } + /* + * Test if model is destroyed without crash + */ + void testDestroyModel() + { + // Make menu available + m_script.publishMenu(); + m_script.run(); + + // create a new model + QDBusMenuModel *model = new QDBusMenuModel(); + model->setBusType(DBusEnums::SessionBus); + model->setBusName(MENU_SERVICE_NAME); + model->setObjectPath(MENU_OBJECT_PATH); + model->start(); + + // Wait for dbus sync + QTest::qWait(500); + + delete model; + } + }; QTEST_MAIN(ModelTest) |