Date: Mon, 05 Jul 2004 14:37:59 +0200
authorSam Lantinga <slouken@libsdl.org>
Wed, 18 Aug 2004 21:41:39 +0000
changeset 92903fb90fc135e
parent 928 6c87754f324c
child 930 02759105b989
Date: Mon, 05 Jul 2004 14:37:59 +0200
From: Yves Maurischat
Subject: [SDL] Crashes when using aRts on Linux

We had a problem with my app using SDL. It always crashed after SDL_OpenAudio(),
if the artsd was running on a Linux machine with KDE. After some investigation
(and searching for differences in other apps using arts) we found out, that the
problem resulted from loading, calling arts_init(), calling arts_free() and
unloading the aRts-Library in .../src/audio/arts/SDL_artsaudio.c twice: first in
"static int Audio_Available()", the second time in "static SDL_AudioDevice
*Audio_CreateDevice(int devindex)".
src/audio/arts/SDL_artsaudio.c
     1.1 --- a/src/audio/arts/SDL_artsaudio.c	Tue Aug 10 20:58:47 2004 +0000
     1.2 +++ b/src/audio/arts/SDL_artsaudio.c	Wed Aug 18 21:41:39 2004 +0000
     1.3 @@ -140,6 +140,13 @@
     1.4  		return available;
     1.5  	}
     1.6  	if ( SDL_NAME(arts_init)() == 0 ) {
     1.7 +#define ARTS_CRASH_HACK	/* Play a stream so aRts doesn't crash */
     1.8 +#ifdef ARTS_CRASH_HACK
     1.9 +		arts_stream_t stream2;
    1.10 +		stream2=SDL_NAME(arts_play_stream)(44100, 16, 2, "SDL");
    1.11 +		SDL_NAME(arts_write)(stream2, "", 0);
    1.12 +		SDL_NAME(arts_close_stream)(stream2);
    1.13 +#endif
    1.14  		available = 1;
    1.15  		SDL_NAME(arts_free)();
    1.16  	}