diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-14 14:57:37 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-14 14:57:37 +0000 |
commit | 3d64cefb8851fcf43b9c6109abdddaf71e340a71 (patch) | |
tree | 570472c4a55ca462fe9e5049a91702859eeb0fed /plugins/ExtraIcons/extraicons.cpp | |
parent | 1d680ee8c0f9b0c2a421a778cb50152581dc2873 (diff) |
- various leaks
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@965 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/ExtraIcons/extraicons.cpp')
-rw-r--r-- | plugins/ExtraIcons/extraicons.cpp | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/plugins/ExtraIcons/extraicons.cpp b/plugins/ExtraIcons/extraicons.cpp index 6c3ae4dc30..f193de7633 100644 --- a/plugins/ExtraIcons/extraicons.cpp +++ b/plugins/ExtraIcons/extraicons.cpp @@ -38,8 +38,6 @@ HINSTANCE hInst; int hLangpack;
-vector<HANDLE> hHooks;
-vector<HANDLE> hServices;
vector<BaseExtraIcon*> registeredExtraIcons;
vector<ExtraIcon*> extraIconsByHandle;
vector<ExtraIcon*> extraIconsBySlot;
@@ -82,14 +80,12 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) extern "C" int __declspec(dllexport) Load(void)
{
-
mir_getLP(&pluginInfo);
DWORD ret = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS2, 0);
clistFirstSlot = HIWORD(ret);
clistSlotCount = LOWORD(ret);
-
// Icons
IcoLib_Register("AlwaysVis", "Contact List", "Always Visible", IDI_ALWAYSVIS);
IcoLib_Register("NeverVis", "Contact List", "Never Visible", IDI_NEVERVIS);
@@ -97,26 +93,25 @@ extern "C" int __declspec(dllexport) Load(void) IcoLib_Register("gender_male", "Contact List", "Male", IDI_MALE);
IcoLib_Register("gender_female", "Contact List", "Female", IDI_FEMALE);
-
// Hooks
- hHooks.push_back(HookEvent(ME_SYSTEM_MODULESLOADED, &ModulesLoaded));
- hHooks.push_back(HookEvent(ME_SYSTEM_PRESHUTDOWN, &PreShutdown));
- hHooks.push_back(HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, &ClistExtraListRebuild));
- hHooks.push_back(HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, &ClistExtraImageApply));
- hHooks.push_back(HookEvent(ME_CLIST_EXTRA_CLICK, &ClistExtraClick));
-
+ HookEvent(ME_SYSTEM_MODULESLOADED, &ModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, &PreShutdown);
+ HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, &ClistExtraListRebuild);
+ HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, &ClistExtraImageApply);
+ HookEvent(ME_CLIST_EXTRA_CLICK, &ClistExtraClick);
// Services
- hServices.push_back(CreateServiceFunction(MS_EXTRAICON_REGISTER, &ExtraIcon_Register));
- hServices.push_back(CreateServiceFunction(MS_EXTRAICON_SET_ICON, &ExtraIcon_SetIcon));
+ CreateServiceFunction(MS_EXTRAICON_REGISTER, &ExtraIcon_Register);
+ CreateServiceFunction(MS_EXTRAICON_SET_ICON, &ExtraIcon_SetIcon);
DefaultExtraIcons_Load();
-
return 0;
}
extern "C" int __declspec(dllexport) Unload(void)
{
+ for (size_t i=0; i < registeredExtraIcons.size(); i++)
+ delete registeredExtraIcons[i];
return 0;
}
@@ -126,15 +121,13 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) if (ServiceExists(MS_MC_GETPROTOCOLNAME))
metacontacts_proto = (char *) CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
-
// add our modules to the KnownModules list
CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME, 0);
CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME "Groups", 0);
- hHooks.push_back(HookEvent(ME_SKIN2_ICONSCHANGED, &IconsChanged));
+ HookEvent(ME_SKIN2_ICONSCHANGED, &IconsChanged);
InitOptions();
-
return 0;
}
@@ -146,16 +139,7 @@ int IconsChanged(WPARAM wParam, LPARAM lParam) int PreShutdown(WPARAM wParam, LPARAM lParam)
{
DefaultExtraIcons_Unload();
-
- unsigned int i;
- for (i = 0; i < hServices.size(); i++)
- DestroyServiceFunction(hServices[i]);
-
- for (i = 0; i < hHooks.size(); i++)
- UnhookEvent(hHooks[i]);
-
DeInitOptions();
-
return 0;
}
|