From 89ce406fb710ff91a3f80d5f1ee674c09a1f7603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Tue, 9 Dec 2014 17:08:22 +0000 Subject: Steam: Add lock to SetStatus (attempt to fix some freeze/crash) git-svn-id: http://svn.miranda-ng.org/main/trunk@11302 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Steam/src/steam_proto.cpp | 4 ++++ protocols/Steam/src/steam_proto.h | 1 + 2 files changed, 5 insertions(+) (limited to 'protocols/Steam') diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 1cd0193702..2cb802c9fd 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -9,6 +9,7 @@ CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) : CreateProtoService(PS_CREATEACCMGRUI, &CSteamProto::OnAccountManagerInit); InitializeCriticalSection(&this->contact_search_lock); + InitializeCriticalSection(&this->set_status_lock); InitQueue(); @@ -69,6 +70,7 @@ CSteamProto::~CSteamProto() UninitQueue(); DeleteCriticalSection(&this->contact_search_lock); + DeleteCriticalSection(&this->set_status_lock); } MCONTACT __cdecl CSteamProto::AddToList(int flags, PROTOSEARCHRESULT* psr) @@ -350,6 +352,8 @@ int __cdecl CSteamProto::SetApparentMode(MCONTACT hContact, int mode) { return 0 int CSteamProto::SetStatus(int new_status) { + mir_cslock lock(set_status_lock); + // Routing statuses not supported by Steam switch (new_status) { diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index 47fe830eef..d3c5b65b0a 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -153,6 +153,7 @@ protected: ULONG hMessageProcess; CRITICAL_SECTION contact_search_lock; CRITICAL_SECTION requests_queue_lock; + CRITICAL_SECTION set_status_lock; LIST requestsQueue; // instances -- cgit v1.2.3