diff options
author | Chris Robinson <[email protected]> | 2008-01-16 13:27:15 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2008-01-16 13:27:15 -0800 |
commit | 8ad16145f69d36d2de6b9d0a032479ca71ff4a67 (patch) | |
tree | 338063d9074dce5dd7da0aef589465e26d34b84b /OpenAL32 | |
parent | bb7b18d4e10b1f1e4d76847f58e0bf778584dc9e (diff) |
Make sure sources are deleted with the context
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alSource.h | 2 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index f6a4619a..c0e829ae 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -97,6 +97,8 @@ typedef struct ALsource struct ALsource *next; } ALsource; +ALvoid ReleaseALSources(ALCcontext *Context); + #ifdef __cplusplus } #endif diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index f0ac5847..13cca8e3 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -2272,3 +2272,23 @@ static ALint GetByteOffset(ALsource *pSource) return lByteOffset; } + + +ALvoid ReleaseALSources(ALCcontext *Context) +{ +#ifdef _DEBUG + if(Context->SourceCount > 0) + AL_PRINT("exit() %d Source(s) NOT deleted\n", Context->SourceCount); +#endif + + while(Context->Source) + { + ALsource *temp = Context->Source; + Context->Source = Context->Source->next; + + // Release source structure + memset(temp, 0, sizeof(ALsource)); + free(temp); + } + Context->SourceCount = 0; +} |