From af8c7f0486c6b5275a53a994d6a55841594d42ae Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> Date: Sat, 29 May 2010 16:27:30 +0000 Subject: Fixed resource leaks git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@521 4f64403b-2f21-0410-a795-97e2b3489a10 --- worldtime/plugwin.cpp | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'worldtime/plugwin.cpp') diff --git a/worldtime/plugwin.cpp b/worldtime/plugwin.cpp index e20030d..ac87a31 100644 --- a/worldtime/plugwin.cpp +++ b/worldtime/plugwin.cpp @@ -26,16 +26,11 @@ HWND label; HWND pluginwind = 0, hwnd_clist = 0; -static CRITICAL_SECTION cs2; - bool hook_window_behaviour_to_clist = true; bool set_format = false; bool show_icons = true; bool hide_menu = false; -HANDLE status_update_thread = 0; - -static HMODULE hUserDll; BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags); @@ -329,7 +324,6 @@ LRESULT CALLBACK mypluginwindow1proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } SetBkMode(dis->hDC, TRANSPARENT); - EnterCriticalSection(&cs2); pItemData = &listbox_items[dis->itemID]; { @@ -356,7 +350,6 @@ LRESULT CALLBACK mypluginwindow1proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } } - LeaveCriticalSection(&cs2); SetBkMode(dis->hDC, OPAQUE); SelectObject(dis->hDC, oldFont); } else { @@ -388,7 +381,6 @@ LRESULT CALLBACK mypluginwindow1proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM TCHAR buf[512], buf2[512]; MyGetSystemTime(&st); - EnterCriticalSection(&cs2); for(int i = 0; i < listbox_items.getCount(); i++) { TIME_ZONE_INFORMATION tzi; tzi.Bias = timezone_list[listbox_items[i].timezone_list_index].TZI.Bias; @@ -427,7 +419,6 @@ LRESULT CALLBACK mypluginwindow1proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM listbox_items[i].icon = (HICON)hIcon; } } - LeaveCriticalSection(&cs2); if(need_repaint) InvalidateRect(label, 0, FALSE); } @@ -736,14 +727,10 @@ int FillList(WPARAM wParam, LPARAM lParam) { SendMessage(label, LB_RESETCONTENT, 0, 0); - EnterCriticalSection(&cs2); - for(int i = 0; i < listbox_items.getCount(); i++) { SendMessage(label, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)listbox_items[i].pszText); } - LeaveCriticalSection(&cs2); - InvalidateRect(label, 0, TRUE); return 0; } @@ -921,7 +908,7 @@ int addmypluginwindow1(HWND parent) HookEvent(ME_SKIN_SERVICESCREATED, SkinReload); } - hUserDll = GetModuleHandleA("user32"); + HMODULE hUserDll = GetModuleHandleA("user32"); if (hUserDll) { MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); MyAnimateWindow=(BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow"); @@ -929,8 +916,6 @@ int addmypluginwindow1(HWND parent) hwnd_clist = parent; - InitializeCriticalSection(&cs2); - hook_window_behaviour_to_clist = (DBGetContactSettingByte(NULL, "WorldTime", "MinMax", DEFAULT_MINMAX ? 1 : 0) == 1); set_format = (DBGetContactSettingByte(NULL, "WorldTime", "EnableTimeFormat", 0) == 1); show_icons = (DBGetContactSettingByte(NULL, "WorldTime", "ShowIcons", 1) == 1); @@ -1099,7 +1084,6 @@ void plugwin_cleanup() { //KillTimer(pluginwind, TIMER_ID2); DestroyWindow(pluginwind); - DeleteCriticalSection(&cs2); - DeleteObject(ContactFont); + DeleteObject(TitleBarFont); } \ No newline at end of file -- cgit v1.2.3