@@ -62,6 +62,8 @@ void RootActionState::setMenu(UnityMenuModel* menu)
6262 connect(m_menu, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), SLOT(onModelRowsRemoved(const QModelIndex&, int, int)));
6363 connect(m_menu, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)), SLOT(onModelDataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)));
6464
65+ connect(m_menu, SIGNAL(destroyed()), SLOT(reset()));
66+
6567 m_menu->setActionStateParser(this);
6668 }
6769 updateActionState();
@@ -97,6 +99,14 @@ void RootActionState::onModelDataChanged(const QModelIndex& topLeft, const QMode
9799 }
98100}
99101
102+void RootActionState::reset() {
103+ m_cachedState.clear();
104+ m_menu = NULL;
105+
106+ Q_EMIT menuChanged();
107+ Q_EMIT updated();
108+}
109+
100110void RootActionState::updateActionState()
101111{
102112 if (m_menu && m_menu->rowCount() > 0) {