summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-28 11:48:45 +0200
committerGeorge Hazan <ghazan@miranda.im>2018-04-28 11:49:29 +0200
commit4aac94ac3a0021307b51ee2adb3965b70d3924e9 (patch)
tree4e36300521747d0921924a8ca14d3331d60e1ef9 /protocols
parentc10884bb4f55f5a56278eeb37d126786433b7396 (diff)
Steam: fix for a possible deadlock
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Steam/src/steam_proto.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp
index 191169160b..43657ce5ad 100644
--- a/protocols/Steam/src/steam_proto.cpp
+++ b/protocols/Steam/src/steam_proto.cpp
@@ -253,8 +253,6 @@ int CSteamProto::SendMsg(MCONTACT hContact, int, const char *message)
int CSteamProto::SetStatus(int new_status)
{
- mir_cslock lock(m_setStatusLock);
-
// Routing statuses not supported by Steam
switch (new_status) {
case ID_STATUS_OFFLINE:
@@ -274,13 +272,17 @@ int CSteamProto::SetStatus(int new_status)
break;
}
- if (new_status == m_iDesiredStatus)
- return 0;
+ int old_status;
+ {
+ mir_cslock lock(m_setStatusLock);
+ if (new_status == m_iDesiredStatus)
+ return 0;
- debugLogA(__FUNCTION__ ": changing status from %i to %i", m_iStatus, new_status);
+ debugLogA(__FUNCTION__ ": changing status from %i to %i", m_iStatus, new_status);
- int old_status = m_iStatus;
- m_iDesiredStatus = new_status;
+ old_status = m_iStatus;
+ m_iDesiredStatus = new_status;
+ }
if (new_status == ID_STATUS_OFFLINE) {
// Reset relogin flag
@@ -305,8 +307,7 @@ int CSteamProto::SetStatus(int new_status)
Login();
}
- else
- m_iStatus = new_status;
+ else m_iStatus = new_status;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);