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/WorldTime.dsp | 9 +-- worldtime/WorldTime.plg | 81 ----------------------- worldtime/WorldTime_9.vcproj | 151 ++++++++++++++++++++++--------------------- worldtime/plugwin.cpp | 20 +----- worldtime/plugwin.h | 2 - 5 files changed, 80 insertions(+), 183 deletions(-) delete mode 100644 worldtime/WorldTime.plg diff --git a/worldtime/WorldTime.dsp b/worldtime/WorldTime.dsp index 8e66c7a..c23e625 100644 --- a/worldtime/WorldTime.dsp +++ b/worldtime/WorldTime.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WORLDTIME_EXPORTS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WORLDTIME_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WORLDTIME_EXPORTS" /YX"common.h" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0xc09 /d "NDEBUG" @@ -69,7 +69,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WORLDTIME_EXPORTS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WORLDTIME_EXPORTS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX- /ZI /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WORLDTIME_EXPORTS" /D "_WINDLL" /D "_AFXDLL" /YX"common.h" /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0xc09 /d "_DEBUG" @@ -100,11 +100,6 @@ SOURCE=.\plugwin.cpp # End Source File # Begin Source File -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# Begin Source File - SOURCE=.\time_convert.cpp # End Source File # Begin Source File diff --git a/worldtime/WorldTime.plg b/worldtime/WorldTime.plg deleted file mode 100644 index 1fd4a90..0000000 --- a/worldtime/WorldTime.plg +++ /dev/null @@ -1,81 +0,0 @@ - - -
-

Build Log

-

---------------------Configuration: WorldTime - Win32 Release-------------------- -

-

Command Lines

-Creating temporary file "C:\DOCUME~1\sje\LOCALS~1\Temp\RSP8E.tmp" with contents -[ -/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WORLDTIME_EXPORTS" /Fp"Release/WorldTime.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c -"C:\Documents and Settings\sje\My Documents\MyProjects\miranda\plugins\WorldTime\options.cpp" -"C:\Documents and Settings\sje\My Documents\MyProjects\miranda\plugins\WorldTime\plugwin.cpp" -"C:\Documents and Settings\sje\My Documents\MyProjects\miranda\plugins\WorldTime\WorldTime.cpp" -] -Creating command line "cl.exe @C:\DOCUME~1\sje\LOCALS~1\Temp\RSP8E.tmp" -Creating temporary file "C:\DOCUME~1\sje\LOCALS~1\Temp\RSP8F.tmp" with contents -[ -comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x22070000" /dll /incremental:no /pdb:"Release/WorldTime.pdb" /machine:I386 /out:"../../bin/release/plugins/WorldTime.dll" /implib:"Release/WorldTime.lib" -".\Release\options.obj" -".\Release\plugwin.obj" -".\Release\StdAfx.obj" -".\Release\time_convert.obj" -".\Release\timezone.obj" -".\Release\WorldTime.obj" -".\Release\WorldTime.res" -] -Creating command line "link.exe @C:\DOCUME~1\sje\LOCALS~1\Temp\RSP8F.tmp" -

Output Window

-Compiling... -options.cpp -plugwin.cpp -WorldTime.cpp -Generating Code... -Linking... - Creating library Release/WorldTime.lib and object Release/WorldTime.exp - - - -

Results

-WorldTime.dll - 0 error(s), 0 warning(s) -

---------------------Configuration: WorldTime - Win32 Debug-------------------- -

-

Command Lines

-Creating temporary file "C:\DOCUME~1\sje\LOCALS~1\Temp\RSP93.tmp" with contents -[ -/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WORLDTIME_EXPORTS" /D "_WINDLL" /D "_AFXDLL" /Fp"Debug/WorldTime.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c -"C:\Documents and Settings\sje\My Documents\MyProjects\miranda\plugins\WorldTime\options.cpp" -"C:\Documents and Settings\sje\My Documents\MyProjects\miranda\plugins\WorldTime\plugwin.cpp" -"C:\Documents and Settings\sje\My Documents\MyProjects\miranda\plugins\WorldTime\WorldTime.cpp" -] -Creating command line "cl.exe @C:\DOCUME~1\sje\LOCALS~1\Temp\RSP93.tmp" -Creating temporary file "C:\DOCUME~1\sje\LOCALS~1\Temp\RSP94.tmp" with contents -[ -user32.lib gdi32.lib shell32.lib advapi32.lib comctl32.lib /nologo /dll /incremental:yes /pdb:"Debug/WorldTime.pdb" /debug /machine:I386 /out:"../../bin/debug/plugins/WorldTime.dll" /implib:"Debug/WorldTime.lib" /pdbtype:sept -".\Debug\options.obj" -".\Debug\plugwin.obj" -".\Debug\StdAfx.obj" -".\Debug\time_convert.obj" -".\Debug\timezone.obj" -".\Debug\WorldTime.obj" -".\Debug\WorldTime.res" -] -Creating command line "link.exe @C:\DOCUME~1\sje\LOCALS~1\Temp\RSP94.tmp" -

Output Window

-Compiling... -WorldTime.cpp -Generating Code... -Skipping... (no relevant changes detected) -options.cpp -plugwin.cpp -Linking... - - - -

Results

-WorldTime.dll - 0 error(s), 0 warning(s) -
- - diff --git a/worldtime/WorldTime_9.vcproj b/worldtime/WorldTime_9.vcproj index 12cf731..50d537d 100644 --- a/worldtime/WorldTime_9.vcproj +++ b/worldtime/WorldTime_9.vcproj @@ -21,13 +21,14 @@ 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 diff --git a/worldtime/plugwin.h b/worldtime/plugwin.h index 24196a9..42cdc95 100644 --- a/worldtime/plugwin.h +++ b/worldtime/plugwin.h @@ -40,8 +40,6 @@ extern HICON upIcon, downIcon; extern ITEMLIST listbox_items; -extern HANDLE mainThread; - extern TCHAR format_string[]; int addmypluginwindow1(HWND parent); -- cgit v1.2.3