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

svn path=/branches/KDE/4.4/kdelibs/; revision=1084456
This commit is contained in:
Aaron J. Seigo 2010-02-03 08:27:33 +00:00
parent 2a7ab28951
commit e3cab4cc26

View File

@ -167,7 +167,16 @@ void InternalToolBox::addTool(QAction *action)
void InternalToolBox::updateToolBox()
{
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 = 0;
}