diff options
author | peter1138 <peter1138@openttd.org> | 2010-01-16 17:47:26 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2010-01-16 17:47:26 +0000 |
commit | 711dea210be01ee918188cc48ca660fee50cd5db (patch) | |
tree | f8defc42812d17a3cd0e31dfc56b122f8e88bb07 /src | |
parent | 6101ad8396b5b5a9cc0e5090e867c131d86d911d (diff) | |
download | openttd-711dea210be01ee918188cc48ca660fee50cd5db.tar.xz |
(svn r18829) -Codechange: Don't free memory from within audio mixer callback handler as it may be required to be real-time safe.
Diffstat (limited to 'src')
-rw-r--r-- | src/mixer.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mixer.cpp b/src/mixer.cpp index 7a94f6eda..30f788aec 100644 --- a/src/mixer.cpp +++ b/src/mixer.cpp @@ -141,9 +141,7 @@ static void mix_int8_to_int16(MixerChannel *sc, int16 *buffer, uint samples) static void MxCloseChannel(MixerChannel *mc) { - free(mc->memory); mc->active = false; - mc->memory = NULL; } void MxMixSamples(void *buffer, uint samples) @@ -170,8 +168,9 @@ MixerChannel *MxAllocateChannel() { MixerChannel *mc; for (mc = _channels; mc != endof(_channels); mc++) - if (mc->memory == NULL) { - mc->active = false; + if (!mc->active) { + free(mc->memory); + mc->memory = NULL; return mc; } return NULL; |