be sure to remove the tool from the tool collection if it gets deleted because the action was removed

svn path=/trunk/KDE/kdelibs/; revision=1084451
This commit is contained in:
Aaron J. Seigo 2010-02-03 08:18:43 +00:00
parent d69885df4d
commit 8fc5c0d2b0

View File

@ -165,7 +165,16 @@ void InternalToolBox::addTool(QAction *action)
void InternalToolBox::updateToolBox() void InternalToolBox::updateToolBox()
{ {
Plasma::IconWidget *tool = qobject_cast<Plasma::IconWidget *>(sender()); Plasma::IconWidget *tool = qobject_cast<Plasma::IconWidget *>(sender());
if (tool && tool->action() == 0) { if (tool && !tool->action()) {
QMutableMapIterator<ToolType, IconWidget *> it(d->tools);
while (it.hasNext()) {
it.next();
if (it.value() == tool) {
it.remove();
break;
}
}
tool->deleteLater(); tool->deleteLater();
tool = 0; tool = 0;
} }