summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/icolib/skin2icons.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp
index 80bcfc5e9e..58137e74d2 100644
--- a/src/modules/icolib/skin2icons.cpp
+++ b/src/modules/icolib/skin2icons.cpp
@@ -575,20 +575,31 @@ HANDLE IcoLib_AddNewIcon(int hLangpack, SKINICONDESC* sid)
/////////////////////////////////////////////////////////////////////////////////////////
// IcoLib_RemoveIcon
-static INT_PTR IcoLib_RemoveIcon(WPARAM, LPARAM lParam)
+static int IcoLib_RemoveIcon_Internal(int i)
{
- if (lParam) {
+ IcolibItem *item = iconList[ i ];
+ IcoLib_FreeIcon(item);
+ iconList.remove(i);
+ SAFE_FREE((void**)&item);
+ return 0;
+}
+
+static INT_PTR IcoLib_RemoveIcon(WPARAM wParam, LPARAM lParam)
+{
+ if (wParam) {
mir_cslock lck(csIconList);
- int i;
- if ((i = iconList.getIndex((IcolibItem*)&lParam)) != -1) {
- IcolibItem *item = iconList[ i ];
- IcoLib_FreeIcon(item);
- iconList.remove(i);
- SAFE_FREE((void**)&item);
- }
+ int i = iconList.indexOf((IcolibItem*)wParam);
+ if (i != -1)
+ return IcoLib_RemoveIcon_Internal(i);
+ }
+
+ if (lParam) {
+ mir_cslock lck(csIconList);
- return (i == -1) ? 1 : 0;
+ int i = iconList.getIndex((IcolibItem*)&lParam);
+ if (i != -1)
+ return IcoLib_RemoveIcon_Internal(i);
}
return 1; // Failed
}