diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-02 22:30:27 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-02 22:30:27 +0000 |
commit | 980bcaff693a86971750d6e9ffc8ba1e561b8b3a (patch) | |
tree | d8a422e9ccd2357d6e28368447bee8cfcd26123a /src/modules/button | |
parent | 990f961261d92fccadb16b495171bb619c0183f0 (diff) |
the core without manual critical sections' control
git-svn-id: http://svn.miranda-ng.org/main/trunk@730 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/button')
-rw-r--r-- | src/modules/button/button.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
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);
}
|