summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ/src/icq_avatar.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-03-06 21:18:37 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-03-06 21:18:37 +0000
commit6185658d9b0da52d35622b63b02771bb72277982 (patch)
tree2e282900d770bff2abb68d147694caaddcbf3994 /protocols/IcqOscarJ/src/icq_avatar.cpp
parent69421d1aeb78dd23015f3bf8a94ae7345bbcc982 (diff)
fix for a rare crash in icq, when avatar's reading gets stuck
git-svn-id: http://svn.miranda-ng.org/main/trunk@12360 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ/src/icq_avatar.cpp')
-rw-r--r--protocols/IcqOscarJ/src/icq_avatar.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp
index 96020d9437..b5f49ee611 100644
--- a/protocols/IcqOscarJ/src/icq_avatar.cpp
+++ b/protocols/IcqOscarJ/src/icq_avatar.cpp
@@ -555,7 +555,8 @@ int CIcqProto::GetAvatarData(MCONTACT hContact, DWORD dwUin, const char *szUid,
for (avatars_request *ar = m_avatarsQueue; ar; ar = ar->pNext) {
if (ar->hContact == hContact && ar->type == ART_BLOCK) { // found a block item
if (GetTickCount() > ar->timeOut) { // remove timeouted block
- ar = ReleaseAvatarRequestInQueue(ar);
+ if ((ar = ReleaseAvatarRequestInQueue(ar)) == NULL)
+ break;
continue;
}
m_avatarsMutex->Leave();
@@ -581,11 +582,11 @@ int CIcqProto::GetAvatarData(MCONTACT hContact, DWORD dwUin, const char *szUid,
// we failed to send request, or avatar thread not ready
// check if any request for this user is not already in the queue
- avatars_request *ar = m_avatarsQueue;
- while (ar) {
+ for (avatars_request *ar = m_avatarsQueue; ar; ar = ar->pNext) {
if (ar->hContact == hContact) { // we found it, return error
if (ar->type == ART_BLOCK && GetTickCount() > ar->timeOut) { // remove timeouted block
- ar = ReleaseAvatarRequestInQueue(ar);
+ if ((ar = ReleaseAvatarRequestInQueue(ar)) == NULL)
+ break;
continue;
}
m_avatarsMutex->Leave();
@@ -595,11 +596,10 @@ int CIcqProto::GetAvatarData(MCONTACT hContact, DWORD dwUin, const char *szUid,
requestAvatarConnection();
return 0;
}
- ar = ar->pNext;
}
// add request to queue, processed after successful login
- ar = new avatars_request(ART_GET); // get avatar
+ avatars_request *ar = new avatars_request(ART_GET); // get avatar
if (!ar) { // out of memory, go away
m_avatarsMutex->Leave();
return 0;