From 856804b568d3f9e7ddd49f07703ff98c83109da5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 31 Oct 2019 17:41:47 +0300 Subject: fixes #2107 (trailing extra-icons aren't wiped from clist after disabling a plugin) --- src/mir_app/src/ei_services.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/mir_app') 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 &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 groups(1); LoadGroups(groups); RebuildListsBasedOnGroups(groups); - ResetSlots(0, 0); + ResetSlots(0, 0, iOldSlot); for (auto &it : arIcons) delete it; -- cgit v1.2.3