From 6185658d9b0da52d35622b63b02771bb72277982 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 6 Mar 2015 21:18:37 +0000 Subject: 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 --- protocols/IcqOscarJ/src/icq_avatar.cpp | 12 ++++++------ protocols/IcqOscarJ/src/version.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'protocols/IcqOscarJ') 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; diff --git a/protocols/IcqOscarJ/src/version.h b/protocols/IcqOscarJ/src/version.h index c3cf0026fb..0030e8609b 100644 --- a/protocols/IcqOscarJ/src/version.h +++ b/protocols/IcqOscarJ/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 11 #define __RELEASE_NUM 2 -#define __BUILD_NUM 6 +#define __BUILD_NUM 7 #include -- cgit v1.2.3