diff options
author | Chris Robinson <[email protected]> | 2010-03-20 21:38:05 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-03-20 21:38:05 -0700 |
commit | 99f28f25b07e28415ce58fd552dcadf2a187c3e3 (patch) | |
tree | 45f9ca387fd88b95b013b022d91b004f6ffed91c /OpenAL32/alSource.c | |
parent | 27358c8ce8dcb9bc6d18c10b652784f068cb2ec2 (diff) |
Avoid calling alDelete* from alGen*
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r-- | OpenAL32/alSource.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index ca5b4e28..bae27709 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -61,17 +61,27 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n,ALuint *sources) // Check that the requested number of sources can be generated if((Context->SourceCount + n) <= Device->MaxNoOfSources) { + ALsource *end; ALsource **list = &Context->SourceList; while(*list) list = &(*list)->next; // Add additional sources to the list (Source->next points to the location for the next Source structure) + end = *list; while(i < n) { *list = calloc(1, sizeof(ALsource)); if(!(*list)) { - alDeleteSources(i, sources); + while(end->next) + { + ALsource *temp = end->next; + end->next = temp->next; + + ALTHUNK_REMOVEENTRY(temp->source); + Context->SourceCount--; + free(temp); + } alSetError(Context, AL_OUT_OF_MEMORY); break; } |