Fix sdktools voice memory corruption (bug 4415, r=dvander)
This commit is contained in:
parent
b413405876
commit
5ca2d469a8
@ -69,6 +69,7 @@ bool DecHookCount(int amount = 1);
|
||||
bool DecHookCount(int amount)
|
||||
{
|
||||
g_VoiceHookCount -= amount;
|
||||
assert(g_VoiceHookCount);
|
||||
if (g_VoiceHookCount == 0)
|
||||
{
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVoiceServer, SetClientListening, voiceserver, &g_SdkTools, &SDKTools::OnSetClientListening, false);
|
||||
@ -199,13 +200,13 @@ void SDKTools::OnClientDisconnecting(int client)
|
||||
g_VoiceMap[i][client] = Listen_Default;
|
||||
if (DecHookCount())
|
||||
{
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Reset this client's mutes, just in case */
|
||||
memset(&g_ClientMutes[client], 0, sizeof(int) * 65);
|
||||
/* Reset this client's mutes */
|
||||
memset(&g_ClientMutes[client], 0, sizeof(bool) * 65);
|
||||
|
||||
/* Reset other clients who send to this client */
|
||||
if (g_ClientOverrides[client] > 0)
|
||||
@ -213,7 +214,6 @@ void SDKTools::OnClientDisconnecting(int client)
|
||||
DecHookCount(g_ClientOverrides[client]);
|
||||
g_ClientOverrides[client] = 0;
|
||||
memset(&g_VoiceMap[client], false, sizeof(ListenOverride) * 65);
|
||||
memset(&g_ClientMutes[client], false, sizeof(bool) * 65);
|
||||
}
|
||||
|
||||
if (g_VoiceFlags[client])
|
||||
|
Loading…
Reference in New Issue
Block a user