[Openal-devel] Initializing openal/alut second time crashes.

Joni Yrjana joyr at netikka.fi
Sun Feb 26 00:04:28 PST 2006


On Sat, 2006-02-25 at 20:33 +0200, Joni Yrjana wrote:
> I'm trying to make it possible in my application to turn sound on and
> off whenever user wants to. But after trying to initialize OpenAL/alut
> second time after closing it, the program crashes. As far as I can tell
> reading the manual, this should be possible to do.
<cut>

Hello,

I grabbed the current CVS source tree, configured with debug enabled and
made the attached patch which does seem to work.

Below is my debugging session with the debug-enabled openal library
before patching.

$ export LD_PRELOAD=/usr/local/lib/libopenal.so
$ gdb ./a.out
GNU gdb Red Hat Linux (6.3.0.0-1.84rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host
libthread_db library "/lib/libthread_db.so.1".

(gdb) r
Starting program: /tmp/a.out 
Reading symbols from shared object read from target memory...done.
Loaded system supplied DSO at 0x444000
[Thread debugging using libthread_db enabled]
[New Thread -1208416576 (LWP 24751)]
grab_native: (path /dev/dsp fd 6)
set_fd in: bufsiz 4096 fmt 0x10 speed 44100 channels 2
set_fd out: bufsiz 1024 fmt 0x10 speed 44100 channels 2
[New Thread -1208419408 (LWP 24754)]
[Thread -1208419408 (zombie) exited]
grab_native: (path /dev/dsp fd 6)
set_fd in: bufsiz 4096 fmt 0x10 speed 44100 channels 2
set_fd out: bufsiz 1024 fmt 0x10 speed 44100 channels 2
[New Thread -1208419408 (LWP 24755)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208416576 (LWP 24751)]
_alcDeviceResume (dev=0x0) at alc/alc_device.c:239
239             dev->ops->resume( dev->privateData );
(gdb) print dev->privateData
Cannot access memory at address 0x8
(gdb) print dev
$1 = (AL_device *) 0x0
(gdb) bt
#0  _alcDeviceResume (dev=0x0) at alc/alc_device.c:239
#1  0x00c05bd2 in alcMakeContextCurrent (handle=0x0) at
alc/alc_context.c:240
#2  0x00000000 in ?? ()
(gdb)


Testing with the patched version looked like this:
$ ./a.out 
grab_native: (path /dev/dsp fd 3)
set_fd in: bufsiz 4096 fmt 0x10 speed 44100 channels 2
set_fd out: bufsiz 1024 fmt 0x10 speed 44100 channels 2
grab_native: (path /dev/dsp fd 3)
set_fd in: bufsiz 4096 fmt 0x10 speed 44100 channels 2
set_fd out: bufsiz 1024 fmt 0x10 speed 44100 channels 2
mutex 0x841f290 busy
$

The mutex couldn't be destroyed but it doesn't seem to have any effect.


Best regards,
 Joni Yrjana

-------------- next part --------------
A non-text attachment was scrubbed...
Name: openal.patch
Type: text/x-patch
Size: 590 bytes
Desc: not available
Url : http://localhost.localdomain/pipermail/openal-devel/attachments/20060226/aebc2c8e/openal.bin


More information about the Openal-devel mailing list