From 980bcaff693a86971750d6e9ffc8ba1e561b8b3a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 2 Jul 2012 22:30:27 +0000 Subject: the core without manual critical sections' control git-svn-id: http://svn.miranda-ng.org/main/trunk@730 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/button/button.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/modules/button') diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp index 8889af9bf5..2f7fce43f4 100644 --- a/src/modules/button/button.cpp +++ b/src/modules/button/button.cpp @@ -306,14 +306,12 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L TTooltips tt; tt.ThreadId = GetCurrentThreadId(); - EnterCriticalSection(&csTips); + mir_cslock lck(csTips); if ((idx = lToolTips.getIndex(&tt)) != -1) { mir_free(lToolTips[idx]); lToolTips.remove(idx); DestroyWindow(bct->hwndToolTips); } - LeaveCriticalSection(&csTips); - bct->hwndToolTips = NULL; } } @@ -489,7 +487,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L TTooltips tt; tt.ThreadId = GetCurrentThreadId(); - EnterCriticalSection(&csTips); + mir_cslock lck(csTips); if ((idx = lToolTips.getIndex(&tt)) != -1) bct->hwndToolTips = lToolTips[idx]->hwnd; else { @@ -499,7 +497,6 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L lToolTips.insert(ptt); bct->hwndToolTips = ptt->hwnd; } - LeaveCriticalSection(&csTips); } ti.cbSize = sizeof(ti); ti.uFlags = TTF_IDISHWND; @@ -646,10 +643,11 @@ int LoadButtonModule(void) void UnloadButtonModule() { - if (bModuleInitialized) { - EnterCriticalSection(&csTips); + if ( !bModuleInitialized) + return; + + { mir_cslock lck(csTips); lToolTips.destroy(); - LeaveCriticalSection(&csTips); - DeleteCriticalSection(&csTips); - } + } + DeleteCriticalSection(&csTips); } -- cgit v1.2.3