From 5df94ff719eccd04c7450df35fb5e3f2b36e2ee7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 13 Jul 2014 10:50:59 +0000 Subject: wrapping the most evident critical sections into a class git-svn-id: http://svn.miranda-ng.org/main/trunk@9785 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/genmenu.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/modules/clist') diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index 0014545c27..3cf0a71c6d 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static bool bIsGenMenuInited; bool bIconsDisabled; -static CRITICAL_SECTION csMenuHook; +static mir_cs csMenuHook; static int NextObjectId = 0x100, NextObjectMenuItemId = CLISTMENUIDMIN; @@ -1150,7 +1150,6 @@ static INT_PTR SRVMO_SetOptionsMenuItem(WPARAM, LPARAM lParam) int InitGenMenu() { - InitializeCriticalSection(&csMenuHook); CreateServiceFunction(MO_BUILDMENU, MO_BuildMenu); CreateServiceFunction(MO_PROCESSCOMMAND, (MIRANDASERVICE)MO_ProcessCommand); @@ -1181,13 +1180,9 @@ int InitGenMenu() int UnitGenMenu() { if (bIsGenMenuInited) { - { - mir_cslock lck(csMenuHook); - MO_RemoveAllObjects(); - bIsGenMenuInited = false; - } - - DeleteCriticalSection(&csMenuHook); + mir_cslock lck(csMenuHook); + MO_RemoveAllObjects(); + bIsGenMenuInited = false; } return 0; } -- cgit v1.2.3