diff options
Diffstat (limited to 'protocols/VKontakte/src/vk_history.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_history.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index b0fd49772b..1e6e1736ad 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -169,15 +169,20 @@ void CVkProto::GetHistoryDlg(MCONTACT hContact, int iLastMsg) void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
{
debugLogA("CVkProto::OnReceiveHistoryMessages %d", reply->resultCode);
- if (reply->resultCode != 200)
+ if (reply->resultCode != 200 || !pReq->pUserInfo)
return;
JSONNode jnRoot;
+ CVkSendMsgParam *param = (CVkSendMsgParam*)pReq->pUserInfo;
const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot);
- if (!jnResponse)
+ if (!jnResponse) {
+ if (!pReq->bNeedsRestart || m_bTerminated) {
+ delete param;
+ pReq->pUserInfo = NULL;
+ }
return;
-
- CVkSendMsgParam *param = (CVkSendMsgParam*)pReq->pUserInfo;
+ }
+
int iTime = jnResponse["datetime"].as_int();
const JSONNode &jnMsgs = jnResponse["items"];
const JSONNode &jnFUsers = jnResponse["fwd_users"];
@@ -249,5 +254,8 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque if (count == iRCount && once == 0)
GetServerHistory(param->hContact, param->iCount + count, iRCount, iTime, param->iMsgID);
- delete param;
+ if (!pReq->bNeedsRestart || m_bTerminated) {
+ delete param;
+ pReq->pUserInfo = NULL;
+ }
}
\ No newline at end of file |