Skip to content

Commit

Permalink
Unref any static buffers when deleting sources.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jun 28, 2019
1 parent bf809a2 commit 6dde537
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions mojoal.c
Expand Up @@ -84,10 +84,6 @@
#endif


// !!! FIXME: sources aren't unref'ing static buffers on deletion (and maybe
// !!! FIXME: on AL_BUFFER changing?)


/*
The locking strategy for this OpenAL implementation is complicated.
Not only do we generally want you to be able to call into OpenAL from any
Expand Down Expand Up @@ -3360,6 +3356,11 @@ static void _alDeleteSources(const ALsizei n, const ALuint *names)
SDL_AtomicSet(&source->allocated, 0); /* will make mixer reject it if currently playing. */
wait_if_source_is_mixing(ctx, source);
source_release_buffer_queue(ctx, source);
if (source->buffer) {
SDL_assert(source->type == AL_STATIC);
(void) SDL_AtomicDecRef(&source->buffer->refcount);
source->buffer = NULL;
}
if (source->stream) {
SDL_FreeAudioStream(source->stream);
source->stream = NULL;
Expand Down

0 comments on commit 6dde537

Please sign in to comment.