summaryrefslogtreecommitdiff
path: root/src/modules/icolib/skin2icons.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-01-27 13:01:57 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-01-27 13:01:57 +0000
commitc70038e7aab4b82a4411284073b0cf6adca17db2 (patch)
treeb60b79c309cbbb6521e8d3597e97dca2763f58f2 /src/modules/icolib/skin2icons.cpp
parent6a52ba7c0566911d27468e748910bd87f0035c6a (diff)
- new way of removing icolib icons by handle
- icon leak fix for Jabber git-svn-id: http://svn.miranda-ng.org/main/trunk@3303 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/icolib/skin2icons.cpp')
-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
}