From ac3b68411027e5bcfee79af0c4fb848f3fdcbee8 Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Sat, 10 Jan 2015 11:29:16 +0000 Subject: VKontakte: fix(???) for crash on fast posting git-svn-id: http://svn.miranda-ng.org/main/trunk@11810 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_proto.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'protocols/VKontakte/src/vk_proto.cpp') diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index eb92fa0504..f3881cd76a 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -510,6 +510,10 @@ int CVkProto::SendMsg(MCONTACT hContact, int flags, const char *msg) void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) { int iResult = ACKRESULT_FAILED; + if (pReq->pUserInfo == NULL){ + debugLogA("CVkProto::OnSendMessage failed! (pUserInfo == NULL)"); + return; + } CVkSendMsgParam *param = (CVkSendMsgParam*)pReq->pUserInfo; debugLogA("CVkProto::OnSendMessage %d", reply->resultCode); @@ -531,12 +535,16 @@ void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) if (param->iMsgID == -1) { CVkFileUploadParam *fup = (CVkFileUploadParam *)param->iCount; ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, iResult, (HANDLE)fup, 0); - delete fup; + if (!pReq->bNeedsRestart) + delete fup; return; } else if (m_bServerDelivery) ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, iResult, HANDLE(param->iMsgID), 0); - delete param; + if (!pReq->bNeedsRestart){ + delete param; + pReq->pUserInfo = NULL; + } } ////////////////////////////////////////////////////////////////////////////// @@ -665,7 +673,8 @@ void CVkProto::OnReceiveAuthRequest(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * } } } - delete param; + if (!pReq->bNeedsRestart) + delete param; } int CVkProto::Authorize(HANDLE hDbEvent) -- cgit v1.2.3