diff options
author | Renato Araujo Oliveira Filho <renato.filho@canonical.com> | 2012-12-11 02:43:08 +0000 |
---|---|---|
committer | Tarmac <> | 2012-12-11 02:43:08 +0000 |
commit | b9e5fb6edebc3ee04ad54ce605500ca1dc87949b (patch) | |
tree | 4e0bf8330b19e3e5695e32f7f4240bfdfa07be67 | |
parent | 5c88419b11b88640305f0b55b3ae453a68934233 (diff) | |
parent | 0b3bfd931f260f8ee1aa20d0245c44f1eb46fffb (diff) | |
download | qmenumodel-b9e5fb6edebc3ee04ad54ce605500ca1dc87949b.tar.gz qmenumodel-b9e5fb6edebc3ee04ad54ce605500ca1dc87949b.tar.bz2 qmenumodel-b9e5fb6edebc3ee04ad54ce605500ca1dc87949b.zip |
Fixed crash during model changes.
Approved by Bill Filler.
-rw-r--r-- | libqmenumodel/src/qmenumodel.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libqmenumodel/src/qmenumodel.cpp b/libqmenumodel/src/qmenumodel.cpp index 1326d77..9a2450c 100644 --- a/libqmenumodel/src/qmenumodel.cpp +++ b/libqmenumodel/src/qmenumodel.cpp @@ -133,7 +133,8 @@ void QMenuModel::clearModel() } Q_FOREACH(QMenuModel* child, *m_cache) { - delete child; + child->setMenuModel(NULL); + child->deleteLater(); } m_cache->clear(); } @@ -295,7 +296,9 @@ void QMenuModel::onItemsChanged(GMenuModel *model, // Remove invalidated menus from the cache for (int i = position, iMax = position + removed; i < iMax; ++i) { if (cache->contains(i)) { - delete cache->take(i); + QMenuModel *model = cache->take(i); + model->setMenuModel(NULL); + model->deleteLater(); } } // Update the indexes of other cached menus to account for the removals |