From dafea8eba9838b9996fdf0c6f0c62982e0d3274f Mon Sep 17 00:00:00 2001 From: Szymon Tokarz Date: Sat, 3 Nov 2012 01:00:15 +0000 Subject: Gadu-Gadu protocol - do not execute code in mainthread (ProtoBroadcastAck) where we are inside critical section and this critical section can be used by main thread in parallel (see bug #45) git-svn-id: http://svn.miranda-ng.org/main/trunk@2158 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Gadu-Gadu/src/avatar.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'protocols/Gadu-Gadu/src') diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index 92bb9f141a..bd41b80b10 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -234,6 +234,8 @@ void __cdecl GGPROTO::avatarrequestthread(void*) PROTO_AVATAR_INFORMATIONT pai = {0}; int result = 0; + gg_LeaveCriticalSection(&avatar_mutex, "avatarrequestthread", 4, 1, "avatar_mutex", 1); + pai.cbSize = sizeof(pai); pai.hContact = data->hContact; pai.format = db_get_b(pai.hContact, m_szModuleName, GG_KEY_AVATARTYPE, GG_KEYDEF_AVATARTYPE); @@ -266,12 +268,18 @@ void __cdecl GGPROTO::avatarrequestthread(void*) if (!pai.hContact) CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0); + gg_EnterCriticalSection(&avatar_mutex, "avatarrequestthread", 80, "avatar_mutex", 1); list_remove(&avatar_transfers, data, 0); + gg_LeaveCriticalSection(&avatar_mutex, "avatarrequestthread", 80, 1, "avatar_mutex", 1); + mir_free(data->AvatarURL); mir_free(data); + } else { + gg_LeaveCriticalSection(&avatar_mutex, "avatarrequestthread", 4, 2, "avatar_mutex", 1); } - gg_LeaveCriticalSection(&avatar_mutex, "avatarrequestthread", 4, 1, "avatar_mutex", 1); + gg_sleep(100, FALSE, "avatarrequestthread", 101, 1); + } for (l = avatar_requests; l; l = l->next) { -- cgit v1.2.3