summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-22 14:57:50 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-22 14:57:50 +0000
commitc650e1e172dd9131dfcb17948113935d805c0dfb (patch)
treebf41aa11a434407715f40e50e0a4050d421f8781 /plugins/Clist_modern
parentbdf88550d1e2807a9c719259385917ba3d0dd91e (diff)
trying to catch hung thread in clist_modern
git-svn-id: http://svn.miranda-ng.org/main/trunk@11582 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r--plugins/Clist_modern/src/hdr/modern_commonprototypes.h10
-rw-r--r--plugins/Clist_modern/src/modern_aniavatars.cpp16
-rw-r--r--plugins/Clist_modern/src/modern_awaymsg.cpp10
-rw-r--r--plugins/Clist_modern/src/modern_clui.cpp12
-rw-r--r--plugins/Clist_modern/src/modern_gettextasync.cpp2
5 files changed, 24 insertions, 26 deletions
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
index 4aefa96a4d..339cc83eb1 100644
--- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
+++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
@@ -67,16 +67,6 @@ extern BYTE gl_TrimText;
/* TYPE DEFS */
/************************************************************************/
-class thread_catcher
-{
- HANDLE &m_ptr;
- __forceinline thread_catcher& operator = (const thread_catcher &) {}
-
-public:
- __forceinline thread_catcher(HANDLE &param) : m_ptr(param) {}
- __forceinline ~thread_catcher() { m_ptr = 0; }
-};
-
typedef INT_PTR(*PSYNCCALLBACKPROC)(WPARAM, LPARAM);
/************************************************************************/
diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp
index 2fcc3731bd..a60083a7e7 100644
--- a/plugins/Clist_modern/src/modern_aniavatars.cpp
+++ b/plugins/Clist_modern/src/modern_aniavatars.cpp
@@ -178,7 +178,9 @@ int _AniAva_OnModulesUnload(WPARAM, LPARAM)
static void _AniAva_AnimationTreadProc(void*)
{
- //wait forever till hExitEvent signalled
+ Netlib_Logf(NULL, "AnimationTreadProc thread start");
+
+ // wait forever till hExitEvent signalled
HANDLE hThread = 0;
s_AnimationThreadID = GetCurrentThreadId();
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
@@ -198,6 +200,8 @@ static void _AniAva_AnimationTreadProc(void*)
else if (rc == WAIT_OBJECT_0)
break;
}
+
+ Netlib_Logf(NULL, "AnimationTreadProc thread end");
CloseHandle(s_AnimationThreadHandle);
s_AnimationThreadHandle = NULL;
}
@@ -375,18 +379,13 @@ int AniAva_SetAvatarPos(MCONTACT hContact, RECT *rc, int overlayIdx, BYTE bAlpha
if (pai) {
ANIAVA_POSINFO * api = (ANIAVA_POSINFO *)malloc(sizeof(ANIAVA_POSINFO));
if (!pai->hWindow) {
- HWND hwnd;
- HWND parent;
ANIAVATARIMAGEINFO avii = { 0 };
//not found -> create window
char szName[150] = "AniAvaWnd_";
- TCHAR * tszName;
_itoa((int)hContact, szName + 10, 16);
- tszName = mir_a2t(szName);
- hwnd = _AniAva_CreateAvatarWindowSync(tszName);
- mir_free(tszName);
- parent = GetAncestor(pcli->hwndContactList, GA_PARENT);
+ HWND hwnd = _AniAva_CreateAvatarWindowSync(_A2T(szName));
+ HWND parent = GetAncestor(pcli->hwndContactList, GA_PARENT);
pai->hWindow = hwnd;
SendMessage(hwnd, AAM_SETPARENT, (WPARAM)parent, 0);
if (_AniAva_GetAvatarImageInfo(pai->dwAvatarUniqId, &avii))
@@ -485,6 +484,7 @@ static void CALLBACK _AniAva_SyncCallerUserAPCProc(DWORD_PTR dwParam)
item->nResult = item->pfnProc(item->wParam, item->lParam);
SetEvent(item->hDoneEvent);
}
+
static INT_PTR _AniAva_CreateAvatarWindowSync_Worker(WPARAM tszName, LPARAM)
{
HWND hwnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TRANSPARENT | WS_EX_NOPARENTNOTIFY, ANIAVAWINDOWCLASS, (TCHAR*)tszName, WS_POPUP,
diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp
index adba1130a3..d98489d9cc 100644
--- a/plugins/Clist_modern/src/modern_awaymsg.cpp
+++ b/plugins/Clist_modern/src/modern_awaymsg.cpp
@@ -76,7 +76,7 @@ static MCONTACT amGetCurrentChain()
*/
static void amThreadProc(void *)
{
- thread_catcher lck(g_hAwayMsgThread);
+ Netlib_Logf(NULL, "amThreadProc thread start");
ClcCacheEntry dnce;
memset(&dnce, 0, sizeof(dnce));
@@ -88,7 +88,7 @@ static void amThreadProc(void *)
if ((time - amRequestTick) < AMASKPERIOD) {
SleepEx(AMASKPERIOD - (time - amRequestTick) + 10, TRUE);
if (MirandaExiting())
- return;
+ goto LBL_Exit;
}
CListSettings_FreeCacheItemData(&dnce);
dnce.hContact = hContact;
@@ -120,13 +120,17 @@ static void amThreadProc(void *)
}
else break;
if (MirandaExiting())
- return;
+ goto LBL_Exit;
}
WaitForSingleObjectEx(hamProcessEvent, INFINITE, TRUE);
ResetEvent(hamProcessEvent);
if (MirandaExiting())
break;
}
+
+LBL_Exit:
+ g_hAwayMsgThread = NULL;
+ Netlib_Logf(NULL, "amThreadProc thread end");
}
BOOL amWakeThread()
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp
index 65b79e2627..a87d3c4cad 100644
--- a/plugins/Clist_modern/src/modern_clui.cpp
+++ b/plugins/Clist_modern/src/modern_clui.cpp
@@ -1425,22 +1425,26 @@ static int CLUI_SyncSmoothAnimation(WPARAM, LPARAM)
static void CLUI_SmoothAnimationThreadProc(void *param)
{
- thread_catcher lck(g_hSmoothAnimationThread);
+ Netlib_Logf(NULL, "SmoothAnimationThreadProc thread end");
if (mutex_bAnimationInProgress) {
do {
if (!g_mutex_bLockUpdating) {
if (MirandaExiting())
- return;
+ break;
Sync(CLUI_SyncSmoothAnimation, 0, (LPARAM)param);
SleepEx(20, TRUE);
if (MirandaExiting())
- return;
+ break;
}
else SleepEx(0, TRUE);
- } while (mutex_bAnimationInProgress);
+ }
+ while (mutex_bAnimationInProgress);
}
+
+ Netlib_Logf(NULL, "SmoothAnimationThreadProc thread end");
+ g_hSmoothAnimationThread = NULL;
}
static int CLUI_SmoothAlphaThreadTransition()
diff --git a/plugins/Clist_modern/src/modern_gettextasync.cpp b/plugins/Clist_modern/src/modern_gettextasync.cpp
index 82f90e95fa..9e0d957baa 100644
--- a/plugins/Clist_modern/src/modern_gettextasync.cpp
+++ b/plugins/Clist_modern/src/modern_gettextasync.cpp
@@ -71,7 +71,6 @@ static void gtaThreadProc(void*)
{
Netlib_Logf(NULL, "GTA thread start");
- thread_catcher lck(g_hGetTextAsyncThread);
SHORTDATA data = { 0 };
while (!MirandaExiting()) {
@@ -118,6 +117,7 @@ static void gtaThreadProc(void*)
LBL_Exit:
CloseHandle(hgtaWakeupEvent);
hgtaWakeupEvent = NULL;
+ g_hGetTextAsyncThread = NULL;
Netlib_Logf(NULL, "GTA thread end");
}