Make action containers aware of deleted commands.

They need to remove them from their internal structure.
This commit is contained in:
con
2011-01-20 15:28:34 +01:00
parent 06acd2cc25
commit 3f0a4446f3
3 changed files with 16 additions and 1 deletions

View File

@@ -247,8 +247,9 @@ ActionManagerPrivate::ActionManagerPrivate(MainWindow *mainWnd)
ActionManagerPrivate::~ActionManagerPrivate()
{
qDeleteAll(m_idCmdMap.values());
// first delete containers to avoid them reacting to command deletion
qDeleteAll(m_idContainerMap.values());
qDeleteAll(m_idCmdMap.values());
}
ActionManagerPrivate *ActionManagerPrivate::instance()
@@ -382,6 +383,7 @@ void ActionManagerPrivate::unregisterAction(QAction *action, const Id &id)
a->removeOverrideAction(action);
if (a->isEmpty()) {
// clean up
// ActionContainers listen to the commands' destroyed signals
m_mainWnd->removeAction(a->action());
delete a->action();
m_idCmdMap.remove(uid);