Package: torcs
Version: 1.3.0-1
Tags: patch
Severity: wishlist

    If torcs attempts to start a race with the OpenAL audio backend
enabled, and OpenAL is unable to open an audio device, torcs
segfaults.  The Plib audio backend just prints an error message when
it cannot open a device, and allows play to continue.  When sound is
disabled, torcs doesn't even try to open a device.  This is admittedly
a bug in OpenAL, but the attached patch to torcs provides a workaround
to allow torcs to work smoothly until the OpenAL issue is addressed.
Please consider this for application.

    To verify the issue and solution, temporarily remove or displace
/etc/openalrc and (if it exists) $HOME/.openalrc; disable OSS (rmmod),
and start torcs.

-- 
Emmet HIKORY
diff -urN torcs-1.3.0/src/modules/graphic/ssggraph/grsound.cpp torcs-1.3.0.new/src/modules/graphic/ssggraph/grsound.cpp
--- src/modules/graphic/ssggraph/grsound.cpp	2006-11-05 10:42:26.000000000 +0900
+++ src/modules/graphic/ssggraph/grsound.cpp	2007-10-08 18:15:29.000000000 +0900
@@ -72,7 +72,14 @@
 	
 	switch (sound_mode) {
 	case OPENAL_MODE:
-		sound_interface = new OpenalSoundInterface (44100, 32);
+		try {
+			sound_interface = new OpenalSoundInterface (44100, 32);
+		}
+		catch (const char *err) {
+			fprintf (stderr, "Disabling Sound: OpenAL initialisation failed: %s\n", err ? err : "");
+			sound_mode = DISABLED;
+			return;
+		}
 		break;
 	case PLIB_MODE:
 		sound_interface = new PlibSoundInterface(44100, 32);

Reply via email to