aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@canonical.com>2012-12-11 02:43:08 +0000
committerTarmac <>2012-12-11 02:43:08 +0000
commitb9e5fb6edebc3ee04ad54ce605500ca1dc87949b (patch)
tree4e0bf8330b19e3e5695e32f7f4240bfdfa07be67
parent5c88419b11b88640305f0b55b3ae453a68934233 (diff)
parent0b3bfd931f260f8ee1aa20d0245c44f1eb46fffb (diff)
downloadqmenumodel-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.cpp7
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