summaryrefslogtreecommitdiff
path: root/src/modules/clist/genmenu.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-06 11:47:56 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-06 11:47:56 +0000
commited5bb0fad1a79a47774223e739902679d049299a (patch)
tree8929ea4f05f9228d94d274badfa100bac33a2a86 /src/modules/clist/genmenu.cpp
parent4ba37ef39d7f0458a8accf3e54ce98c1b8421ce0 (diff)
valid Core plugins' processing during dynamic load/unload
git-svn-id: http://svn.miranda-ng.org/main/trunk@789 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/clist/genmenu.cpp')
-rw-r--r--src/modules/clist/genmenu.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp
index 33b94d6cf8..62749733d3 100644
--- a/src/modules/clist/genmenu.cpp
+++ b/src/modules/clist/genmenu.cpp
@@ -555,21 +555,38 @@ INT_PTR MO_RemoveMenuItem(WPARAM wParam, LPARAM)
///////////////////////////////////////////////////////////////////////////////
-int KillMenuItems(PMO_IntMenuItem pimi, void* param)
+struct KillMenuItemsParam
{
- if (pimi->hLangpack == (int)param)
- MO_RemoveMenuItem((WPARAM)pimi, 0);
+ KillMenuItemsParam(int _hLangpack) :
+ hLangpack(_hLangpack),
+ arItems(10)
+ {}
+
+ int hLangpack;
+ LIST<TMO_IntMenuItem> arItems;
+};
+
+int KillMenuItems(PMO_IntMenuItem pimi, KillMenuItemsParam* param)
+{
+ if (pimi->hLangpack == param->hLangpack)
+ param->arItems.insert(pimi);
return FALSE;
}
void KillModuleMenus(int hLangpack)
{
- if (bIsGenMenuInited) {
- mir_cslock lck(csMenuHook);
+ if (!bIsGenMenuInited)
+ return;
- for (int i=0; i < g_menus.getCount(); i++)
- MO_RecursiveWalkMenu(g_menus[i]->m_items.first, KillMenuItems, (void*)hLangpack);
- }
+ KillMenuItemsParam param(hLangpack);
+
+ mir_cslock lck(csMenuHook);
+ for (int i=0; i < g_menus.getCount(); i++)
+ MO_RecursiveWalkMenu(g_menus[i]->m_items.first, (pfnWalkFunc)KillMenuItems, &param);
+
+ for (int k=0; k < param.arItems.getCount(); k++)
+ MO_RemoveMenuItem((WPARAM)param.arItems[k], 0);
+ param.arItems.destroy();
}
///////////////////////////////////////////////////////////////////////////////