Bug 114023

Summary: removing applets from menubar via "Remove from Menubar"->"Applet"->"foo bar" removes wrong applet
Product: [Plasma] plasma-integration Reporter: Michael Olbrich <michael.olbrich>
Component: generalAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: bobbyrfried
Priority: NOR    
Version First Reported In: 5.27.5   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Michael Olbrich 2005-10-07 14:49:06 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

I have a MacOS style menubar with several applets on it. When I tried to remove  one of the applets via "Remove from Menubar"->"Applet"->"foo bar" but another one was removed. Some facts that might help:
- The applet I tried to remove was the last one added.
- I removed several applets while trying to the move the one applet.
- when only two where left the same action had no effect any more.
- trying to remove the other one resulted in removing the one I originally wanted to remove.

svn://anonsvn.kde.org/home/kde/branches/KDE/3.5/kdebase/kicker
At revision 468212.
Comment 1 Aaron J. Seigo 2005-10-07 21:28:10 UTC
SVN commit 468345 by aseigo:

remove the correct applet even when only some are immutable
BUG:114023


 M  +5 -3      removeapplet_mnu.cpp  


--- branches/KDE/3.5/kdebase/kicker/kicker/ui/removeapplet_mnu.cpp #468344:468345
@@ -52,19 +52,21 @@
     QValueList<PanelMenuItemInfo> items;
 
     for (BaseContainer::List::const_iterator it = m_containers.constBegin();
-         it != m_containers.constEnd();
-         ++it)
+         it != m_containers.constEnd();)
     {
         BaseContainer* container = *it;
         if (container->isImmutable())
         {
+            it = ++it;
+            m_containers.remove(container);
             continue;
         }
 
         items.append(PanelMenuItemInfo(container->icon(),
                                        container->visibleName().replace("&", "&&"),
                                        id));
-        id++;
+        ++id;
+        ++it;
     }
 
     qHeapSort(items);