[Openal] Crashing when calling alDeleteBuffers
Chris Robinson
chris.kcat at gmail.com
Sat Jul 4 21:41:35 PDT 2009
On Saturday 04 July 2009 7:37:38 pm fungos wrote:
> I'm streaming an ogg music to the openal and if I do an unload and
> load another music it works, but when I call the same unload method
> from window close event (before any openal deinit) it crashes inside
> openal alDeleteBuffers when trying to "free" the second buffer data
> (and I don't found if it is really related to closing window it is
> just the way I can reproduce).
How are the buffers declared and allocated? It may also help to see how the
buffers are (re)filled. The only issue I see in the Unload method is:
> memset(iBuffers, '\0', OPENAL_MUSIC_BUFFERS);
memset takes the number of bytes to set to the given value, which should be
sizeof(ALuint) times more. Eg:
memset(iBuffers, '\0', OPENAL_MUSIC_BUFFERS*sizeof(iBuffers[0]));
or even just:
memset(iBuffers, '\0', sizeof(iBuffers));
if iBuffers is a static-sized array.
> I downloaded the source code from openal soft and debugged inside it
> (and tried the lastest release 1.8.466 too), both crashed at
> alBuffer.c line 189 but only for the second iteration (second buffer
> handle). As openal makes a copy of my pcm data I really don't think
> that it has anything to do with the ogg streaming.
> Last week I tested it on Windows and it was not crashing, but I will
> do some testing with MacOSX and Windows as soon as possible to be
> sure.
The only thing I could guess at this point is some kind of memory corruption.
The data pointer shouldn't be in use because of the lock on the context, and
it should be valid (NULL or a pointer given by realloc). The buffer ID is also
validated. If possible, try running with valgrind (with the debug-enabled
openal lib).
More information about the Openal
mailing list