Browse Source

Lets try this again

voice-allocs
RogueException 7 years ago
parent
commit
5714a50b5b
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      src/Discord.Net.WebSocket/Audio/AudioClient.cs

+ 4
- 4
src/Discord.Net.WebSocket/Audio/AudioClient.cs View File

@@ -103,7 +103,7 @@ namespace Discord.Audio
{
StopAsync().GetAwaiter().GetResult();
ApiClient.Dispose();
if (_secretKeyHandle.Target != null)
if (_secretKeyHandle.IsAllocated)
_secretKeyHandle.Free();
_isDisposed = true;
}
@@ -260,10 +260,10 @@ namespace Discord.Audio
if (data.Mode != DiscordVoiceAPIClient.Mode)
throw new InvalidOperationException($"Discord selected an unexpected mode: {data.Mode}");

if (_secretKeyHandle.Target != null)
_secretKeyHandle.Free();
_secretKey = data.SecretKey;
_secretKeyHandle = GCHandle.Alloc(data.SecretKey, GCHandleType.Pinned);
if (_secretKeyHandle.IsAllocated)
_secretKeyHandle.Free();
_secretKeyHandle = GCHandle.Alloc(_secretKey, GCHandleType.Pinned);
SecretKeyPtr = _secretKeyHandle.AddrOfPinnedObject();

_isSpeaking = false;


Loading…
Cancel
Save