From 8f5b9bfe091acdc752ad2c92202933b6d86c7492 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 18 Aug 2004 21:41:39 +0000 Subject: [PATCH] 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/audio/arts/SDL_artsaudio.c b/src/audio/arts/SDL_artsaudio.c index e4740b7f5..aef19a492 100644 --- a/src/audio/arts/SDL_artsaudio.c +++ b/src/audio/arts/SDL_artsaudio.c @@ -140,6 +140,13 @@ static int Audio_Available(void) return available; } if ( SDL_NAME(arts_init)() == 0 ) { +#define ARTS_CRASH_HACK /* Play a stream so aRts doesn't crash */ +#ifdef ARTS_CRASH_HACK + arts_stream_t stream2; + stream2=SDL_NAME(arts_play_stream)(44100, 16, 2, "SDL"); + SDL_NAME(arts_write)(stream2, "", 0); + SDL_NAME(arts_close_stream)(stream2); +#endif available = 1; SDL_NAME(arts_free)(); }