summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-10-31 17:41:47 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-10-31 17:41:47 +0300
commit856804b568d3f9e7ddd49f07703ff98c83109da5 (patch)
treefdcd078e2ac06303558df79c97bcc3eec2d73880
parent05f5df51f72a7a597d606a9ffb95bbd326f06880 (diff)
fixes #2107 (trailing extra-icons aren't wiped from clist after disabling a plugin)
-rw-r--r--src/mir_app/src/ei_services.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mir_app/src/ei_services.cpp b/src/mir_app/src/ei_services.cpp
index 82f83ecc0c..911dd19f9d 100644
--- a/src/mir_app/src/ei_services.cpp
+++ b/src/mir_app/src/ei_services.cpp
@@ -157,7 +157,7 @@ void RebuildListsBasedOnGroups(LIST<ExtraIconGroup> &groups)
///////////////////////////////////////////////////////////////////////////////
-static void ResetSlots(BaseExtraIcon *extra, ExtraIconGroup *group)
+static void ResetSlots(BaseExtraIcon *extra, ExtraIconGroup *group, int iOldSlot = -1)
{
int slot = 0, oldMaxSlot = -1;
for (auto &ex : extraIconsBySlot) {
@@ -174,6 +174,9 @@ static void ResetSlots(BaseExtraIcon *extra, ExtraIconGroup *group)
ex->applyIcons();
}
+ if (iOldSlot > oldMaxSlot)
+ oldMaxSlot = iOldSlot + 1;
+
// slots were freed, we need to clear one or more items
if (extra == nullptr)
for (int i = slot; i < oldMaxSlot; i++)
@@ -200,10 +203,15 @@ MIR_APP_DLL(void) KillModuleExtraIcons(HPLUGIN pPlugin)
if (arIcons.getCount() == 0)
return;
+ int iOldSlot = -1;
+ for (auto &it : arIcons)
+ if (it->getSlot() > iOldSlot)
+ iOldSlot = it->getSlot() + 1;
+
LIST<ExtraIconGroup> groups(1);
LoadGroups(groups);
RebuildListsBasedOnGroups(groups);
- ResetSlots(0, 0);
+ ResetSlots(0, 0, iOldSlot);
for (auto &it : arIcons)
delete it;