From a45a0d45d105d05998e94598f2a9b880fb557ed8 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 12 Dec 2016 15:32:01 +0100 Subject: [PATCH] audio: do not free buffers that SDL may be using. --- src/audio/audio.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index df2206f5..709ea2b9 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -33,6 +33,7 @@ struct audio_streamer int m_channel; std::function m_callback; #if defined LOL_USE_SDL_MIXER + array m_empty; // SDL keeps a reference to this Mix_Chunk *m_chunk; #endif }; @@ -95,9 +96,8 @@ int audio::start_streaming(std::function const &f) audio_streamer *s = new audio_streamer(); g_streamers.push(s); - array empty; - empty.resize(1024); - s->m_chunk = Mix_QuickLoad_RAW(empty.data(), empty.bytes()); + s->m_empty.resize(1024); + s->m_chunk = Mix_QuickLoad_RAW(s->m_empty.data(), s->m_empty.bytes()); s->m_channel = Mix_PlayChannel(-1, s->m_chunk, -1); s->m_callback = f; Mix_RegisterEffect(s->m_channel, trampoline, nullptr, s);