summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Tokarz <wsx22@o2.pl>2012-11-03 01:00:15 +0000
committerSzymon Tokarz <wsx22@o2.pl>2012-11-03 01:00:15 +0000
commitdafea8eba9838b9996fdf0c6f0c62982e0d3274f (patch)
treed37cf3c4c057c45ab6181c60faed654dacf7757e
parentb6c5e03eb8c6e746ec4b1f28c472c93305986bbf (diff)
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
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp10
1 files changed, 9 insertions, 1 deletions
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) {