From e9e09da819c2f3b3a6405048232f38649d567b4d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 23 Jul 2015 11:17:54 +0000 Subject: fix for incorrect Win API calls git-svn-id: http://svn.miranda-ng.org/main/trunk@14652 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_aniavatars.cpp | 3 ++- plugins/Clist_modern/src/modern_clc.cpp | 4 +++- plugins/Clist_modern/src/modern_gettextasync.cpp | 3 ++- src/mir_app/src/clc.cpp | 4 +++- src/mir_app/src/proto_utils.cpp | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index f6e36bd95a..679f5283fa 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -1009,7 +1009,8 @@ int AniAva_InitModule() void _AniAva_OnModulesUnload() { - SetEvent(s_hExitEvent); + if (s_hExitEvent) + SetEvent(s_hExitEvent); } int AniAva_UnloadModule() diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 2f31dc6777..34c9c76e16 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1331,8 +1331,10 @@ static LRESULT clcOnDestroy(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP ImageArray_Clear(&dat->avatar_cache); DeleteDC(dat->avatar_cache.hdc); ImageArray_Free(&dat->avatar_cache, FALSE); - if (dat->himlHighlight) + if (dat->himlHighlight) { ImageList_Destroy(dat->himlHighlight); + dat->himlHighlight = NULL; + } RowHeights_Free(dat); corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); diff --git a/plugins/Clist_modern/src/modern_gettextasync.cpp b/plugins/Clist_modern/src/modern_gettextasync.cpp index 43738f5246..71e81c05ed 100644 --- a/plugins/Clist_modern/src/modern_gettextasync.cpp +++ b/plugins/Clist_modern/src/modern_gettextasync.cpp @@ -161,7 +161,8 @@ void gtaRenewText(MCONTACT hContact) void gtaShutdown() { - SetEvent(hgtaWakeupEvent); + if (hgtaWakeupEvent) + SetEvent(hgtaWakeupEvent); } void InitCacheAsync() diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 0d23022956..d6baa3ff91 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -1304,8 +1304,10 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (!dat->fontInfo[i].changed) DeleteObject(dat->fontInfo[i].hFont); - if (dat->himlHighlight) + if (dat->himlHighlight) { ImageList_Destroy(dat->himlHighlight); + dat->himlHighlight = NULL; + } if (dat->hwndRenameEdit) DestroyWindow(dat->hwndRenameEdit); if (dat->hBmpBackground) diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index d00fbd27a8..ab8227f0fd 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -57,7 +57,7 @@ MIR_APP_DLL(void) Proto_EnumProtocols(int *nProtos, PROTOCOLDESCRIPTOR ***pProto MIR_APP_DLL(void) ProtoLogA(struct PROTO_INTERFACE *pThis, LPCSTR szFormat, va_list args) { char buf[4096]; - int res = _vsnprintf(buf, sizeof(buf), szFormat, args); + int res = _vsnprintf(buf, _countof(buf), szFormat, args); CallService(MS_NETLIB_LOG, (WPARAM)(pThis ? pThis->m_hNetlibUser : NULL), (LPARAM)((res != -1) ? buf : CMStringA().FormatV(szFormat, args))); } -- cgit v1.2.3