diff --git a/src/menu.cpp b/src/menu.cpp index 29bf61f..126b32f 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -312,14 +312,26 @@ bool Menu::addSection(const string §ionName) { return false; } -void Menu::deleteSelectedLink() { +void Menu::deleteSelectedLink() +{ + bool icon_used = false; + string iconpath = selLink()->getIconPath(); + INFO("Deleting link '%s'\n", selLink()->getTitle().c_str()); if (selLinkApp()!=NULL) unlink(selLinkApp()->getFile().c_str()); - gmenu2x->sc.del(selLink()->getIconPath()); sectionLinks()->erase( sectionLinks()->begin() + selLinkIndex() ); setLinkIndex(selLinkIndex()); + + for (vector::iterator section = links.begin(); + !icon_used && sectionbegin(); + !icon_used && linkend(); link++) + icon_used = !iconpath.compare((*link)->getIconPath()); + + if (!icon_used) + gmenu2x->sc.del(iconpath); } void Menu::deleteSelectedSection() {