summaryrefslogtreecommitdiff
path: root/protocols/ICQ-WIM
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-01-23 19:50:02 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-01-23 19:50:02 +0300
commit8ebf21e565886d2629ba2ad5b74466879c529c3e (patch)
tree1dac70aa4e69455706f3a9eba9d4ab678c53b674 /protocols/ICQ-WIM
parent0489bed8751d89c37ee7a3eb08cc8aa80b3524a0 (diff)
fixes #1760 (ICQ10: random crash)
Diffstat (limited to 'protocols/ICQ-WIM')
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp5
-rw-r--r--protocols/ICQ-WIM/src/proto.h1
-rw-r--r--protocols/ICQ-WIM/src/server.cpp3
3 files changed, 8 insertions, 1 deletions
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index ed713f3983..09162fc744 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -364,7 +364,10 @@ int CIcqProto::SendMsg(MCONTACT hContact, int, const char *pszSrc)
auto *pOwn = new IcqOwnMessage(hContact, id, pReq->m_reqId);
pReq->pUserInfo = pOwn;
- m_arOwnIds.insert(pOwn);
+ {
+ mir_cslock lck(m_csOwnIds);
+ m_arOwnIds.insert(pOwn);
+ }
pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("aimsid", m_aimsid) << CHAR_PARAM("f", "json") << CHAR_PARAM("k", ICQ_APP_ID)
<< CHAR_PARAM("mentions", "") << CHAR_PARAM("message", pszSrc) << CHAR_PARAM("offlineIM", "true") << CHAR_PARAM("r", pReq->m_reqId)
diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h
index 06fc56c367..3cfd15f115 100644
--- a/protocols/ICQ-WIM/src/proto.h
+++ b/protocols/ICQ-WIM/src/proto.h
@@ -141,6 +141,7 @@ class CIcqProto : public PROTO<CIcqProto>
int m_iRClientId;
HGENMENU m_hUploadGroups;
+ mir_cs m_csOwnIds;
OBJLIST<IcqOwnMessage> m_arOwnIds;
////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp
index dfe5639cc8..9491c855e2 100644
--- a/protocols/ICQ-WIM/src/server.cpp
+++ b/protocols/ICQ-WIM/src/server.cpp
@@ -68,6 +68,7 @@ MCONTACT CIcqProto::CheckOwnMessage(const CMStringA &reqId, const CMStringA &msg
if (db_event_getById(m_szModuleName, msgId) == 0)
db_event_setId(m_szModuleName, 1, msgId);
+ mir_cslock lck(m_csOwnIds);
m_arOwnIds.remove(m_arOwnIds.indexOf(&own));
}
return ret;
@@ -627,6 +628,8 @@ void CIcqProto::OnSendMessage(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq)
JsonReply root(pReply);
if (root.error() != 200) {
ProtoBroadcastAck(ownMsg->m_hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)ownMsg->m_msgid, 0);
+
+ mir_cslock lck(m_csOwnIds);
for (auto &it : m_arOwnIds) {
if (it == ownMsg) {
m_arOwnIds.remove(m_arOwnIds.indexOf(&it));