diff options
author | Mikkel Krautz <mikkel@krautz.dk> | 2016-05-15 18:54:48 +0300 |
---|---|---|
committer | Mikkel Krautz <mikkel@krautz.dk> | 2016-06-24 01:03:12 +0300 |
commit | c8bd94195a9f869a82c7b53569dcd119e982df04 (patch) | |
tree | 4648c45c74323331cb4947efe97a2098e7052345 /src/murmur/Messages.cpp | |
parent | 80c6e311e2ef32f1ca5f2bb3ffde000bb9c9c243 (diff) |
Hold write lock on qrwlVoiceThread when writing to bSelfDeaf, bSelfMute and ssContext.
Diffstat (limited to 'src/murmur/Messages.cpp')
-rw-r--r-- | src/murmur/Messages.cpp | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/murmur/Messages.cpp b/src/murmur/Messages.cpp index e25f8d07d..04dfd3b48 100644 --- a/src/murmur/Messages.cpp +++ b/src/murmur/Messages.cpp @@ -622,26 +622,33 @@ void Server::msgUserState(ServerUser *uSource, MumbleProto::UserState &msg) { bBroadcast = true; } - if (msg.has_self_deaf()) { - uSource->bSelfDeaf = msg.self_deaf(); - if (uSource->bSelfDeaf) - msg.set_self_mute(true); - bBroadcast = true; - } + // Writing to bSelfMute, bSelfDeaf and ssContext + // requires holding a write lock on qrwlVoiceThread. + { + QWriteLocker wl(&qrwlVoiceThread); - if (msg.has_self_mute()) { - uSource->bSelfMute = msg.self_mute(); - if (! uSource->bSelfMute) { - msg.set_self_deaf(false); - uSource->bSelfDeaf = false; + if (msg.has_self_deaf()) { + uSource->bSelfDeaf = msg.self_deaf(); + if (uSource->bSelfDeaf) + msg.set_self_mute(true); + bBroadcast = true; } - bBroadcast = true; - } - if (msg.has_plugin_context()) { - uSource->ssContext = msg.plugin_context(); - // Make sure to clear this from the packet so we don't broadcast it - msg.clear_plugin_context(); + if (msg.has_self_mute()) { + uSource->bSelfMute = msg.self_mute(); + if (! uSource->bSelfMute) { + msg.set_self_deaf(false); + uSource->bSelfDeaf = false; + } + bBroadcast = true; + } + + if (msg.has_plugin_context()) { + uSource->ssContext = msg.plugin_context(); + + // Make sure to clear this from the packet so we don't broadcast it + msg.clear_plugin_context(); + } } if (msg.has_plugin_identity()) { |