Is it a bug in SDL about re-initializing SDL?

Hi, everybody.

I use SDL SDL-1.2.7-3 for developing application.
In my application I try to reset the paramters of audio data,
so I call the SDL functions sequently:
SDL_Init (SDL_INIT_AUDIO);
SDL_OpenAudio (myspec, NULL);

SDL_PauseAudio (1);
SDL_CloseAudio ();
SDL_OpenAudio (newspec, NULL);
It brings out the result as following:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -150652736 (LWP 5180)]
0x004851fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
(gdb) bt
#0 0x004851fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
#1 0x00463df4 in Arts::Dispatcher::Dispatcher () from /usr/lib/libmcop.so.1
#2 0x00260975 in arts_backend_init () from /usr/lib/libartscbackend.so.0
#3 0x00296546 in arts_init () from /usr/lib/libartsc.so.0
#4 0x0063ffba in SDL_MixAudio_MMX_S8 () from /usr/lib/libSDL-1.2.so.0
#5 0x0063b383 in SDL_AudioInit () from /usr/lib/libSDL-1.2.so.0
#6 0x0063a31b in SDL_InitSubSystem () from /usr/lib/libSDL-1.2.so.0
#7 0x0063b6ec in SDL_OpenAudio () from /usr/lib/libSDL-1.2.so.0
#8 0x0804922a in DrvSetParam (g=0x804b2e0, param=0xfef09370) at sdlsnd.cpp:130
#9 0x08049be1 in AudioSetParam (h=0x804b2a0, param=0xfef09370) at
alib/audio_lower.cpp:106
#10 0x08048e41 in main (argc=1, argv=0xfef09464) at naudiolib.cpp:160

In the other case I called SDL_Quit () before reset. and the
functions calling is as following:
SDL_Init (SDL_INIT_AUDIO);
SDL_OpenAudio (myspec, NULL);

SDL_PauseAudio (1);
SDL_CloseAudio ();
SDL_Quit ();
SDL_Init (SDL_INIT_AUDIO);
SDL_OpenAudio (newspec, NULL);
it brought out the result as:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -150611776 (LWP 5166)]
0x004911fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
(gdb) bt
#0 0x004911fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
#1 0x0046fdf4 in Arts::Dispatcher::Dispatcher () from /usr/lib/libmcop.so.1
#2 0x00119975 in arts_backend_init () from /usr/lib/libartscbackend.so.0
#3 0x0027b546 in arts_init () from /usr/lib/libartsc.so.0
#4 0x0063ffba in SDL_MixAudio_MMX_S8 () from /usr/lib/libSDL-1.2.so.0
#5 0x0063b383 in SDL_AudioInit () from /usr/lib/libSDL-1.2.so.0
#6 0x0063a31b in SDL_InitSubSystem () from /usr/lib/libSDL-1.2.so.0
#7 0x0063a397 in SDL_Init () from /usr/lib/libSDL-1.2.so.0

I wonder if this is a bug in SDL and how to fix it?

Thank you for your reading my letter!

best regards.

Linxs

linxs wrote:

Hi, everybody.

I use SDL SDL-1.2.7-3 for developing application.
In my application I try to reset the paramters of audio data,
so I call the SDL functions sequently:
SDL_Init (SDL_INIT_AUDIO);
SDL_OpenAudio (myspec, NULL);

SDL_PauseAudio (1);
SDL_CloseAudio ();
SDL_OpenAudio (newspec, NULL);
It brings out the result as following:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -150652736 (LWP 5180)]
0x004851fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
(gdb) bt
#0 0x004851fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
#1 0x00463df4 in Arts::Dispatcher::Dispatcher () from /usr/lib/libmcop.so.1
#2 0x00260975 in arts_backend_init () from /usr/lib/libartscbackend.so.0
#3 0x00296546 in arts_init () from /usr/lib/libartsc.so.0
#4 0x0063ffba in SDL_MixAudio_MMX_S8 () from /usr/lib/libSDL-1.2.so.0
#5 0x0063b383 in SDL_AudioInit () from /usr/lib/libSDL-1.2.so.0
#6 0x0063a31b in SDL_InitSubSystem () from /usr/lib/libSDL-1.2.so.0
#7 0x0063b6ec in SDL_OpenAudio () from /usr/lib/libSDL-1.2.so.0
#8 0x0804922a in DrvSetParam (g=0x804b2e0, param=0xfef09370) at sdlsnd.cpp:130
#9 0x08049be1 in AudioSetParam (h=0x804b2a0, param=0xfef09370) at
alib/audio_lower.cpp:106
#10 0x08048e41 in main (argc=1, argv=0xfef09464) at naudiolib.cpp:160

In the other case I called SDL_Quit () before reset. and the
functions calling is as following:
SDL_Init (SDL_INIT_AUDIO);
SDL_OpenAudio (myspec, NULL);

SDL_PauseAudio (1);
SDL_CloseAudio ();
SDL_Quit ();
SDL_Init (SDL_INIT_AUDIO);
SDL_OpenAudio (newspec, NULL);
it brought out the result as:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -150611776 (LWP 5166)]
0x004911fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
(gdb) bt
#0 0x004911fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
#1 0x0046fdf4 in Arts::Dispatcher::Dispatcher () from /usr/lib/libmcop.so.1
#2 0x00119975 in arts_backend_init () from /usr/lib/libartscbackend.so.0
#3 0x0027b546 in arts_init () from /usr/lib/libartsc.so.0
#4 0x0063ffba in SDL_MixAudio_MMX_S8 () from /usr/lib/libSDL-1.2.so.0
#5 0x0063b383 in SDL_AudioInit () from /usr/lib/libSDL-1.2.so.0
#6 0x0063a31b in SDL_InitSubSystem () from /usr/lib/libSDL-1.2.so.0
#7 0x0063a397 in SDL_Init () from /usr/lib/libSDL-1.2.so.0

I wonder if this is a bug in SDL and how to fix it?

Do you have a (preferably short) source code that can reproduce the
problem ?

Stephane

source: testsdl.c

#include <SDL/SDL.h>
#include <SDL/SDL_audio.h>

static void sdlcallback (void *unused, Uint8 *stream, int len)
{
}

int main () {

SDL_AudioSpec spec;

printf ("Init SDL\n");
SDL_Init (SDL_INIT_AUDIO);

spec.freq = 44100;
spec.format = AUDIO_S16LSB;
spec.channels = 2;
spec.samples = 1024 * 4;
spec.callback = sdlcallback;
spec.userdata = 0;
printf ("Open SDL\n");
SDL_OpenAudio (&spec, NULL);
printf ("Close SDL\n");
SDL_CloseAudio ();
printf ("Quit SDL\n");
SDL_Quit ();

printf ("Re-Init SDL\n");
SDL_Init (SDL_INIT_AUDIO);
printf ("Re-open SDL\n");
SDL_OpenAudio (&spec, NULL);
printf ("Close SDL\n");
SDL_CloseAudio ();
printf ("Quit SDL\n");
SDL_Quit ();

return 0;

}

compile and link: gcc -o tsdl testsdl.c -lSDLOn Tue, 11 Jan 2005 19:12:26 +0100, Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:

linxs wrote:

Hi, everybody.

I use SDL SDL-1.2.7-3 for developing application.
In my application I try to reset the paramters of audio data,
so I call the SDL functions sequently:
SDL_Init (SDL_INIT_AUDIO);
SDL_OpenAudio (myspec, NULL);

SDL_PauseAudio (1);
SDL_CloseAudio ();
SDL_OpenAudio (newspec, NULL);
It brings out the result as following:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -150652736 (LWP 5180)]
0x004851fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
(gdb) bt
#0 0x004851fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
#1 0x00463df4 in Arts::Dispatcher::Dispatcher () from /usr/lib/libmcop.so.1
#2 0x00260975 in arts_backend_init () from /usr/lib/libartscbackend.so.0
#3 0x00296546 in arts_init () from /usr/lib/libartsc.so.0
#4 0x0063ffba in SDL_MixAudio_MMX_S8 () from /usr/lib/libSDL-1.2.so.0
#5 0x0063b383 in SDL_AudioInit () from /usr/lib/libSDL-1.2.so.0
#6 0x0063a31b in SDL_InitSubSystem () from /usr/lib/libSDL-1.2.so.0
#7 0x0063b6ec in SDL_OpenAudio () from /usr/lib/libSDL-1.2.so.0
#8 0x0804922a in DrvSetParam (g=0x804b2e0, param=0xfef09370) at sdlsnd.cpp:130
#9 0x08049be1 in AudioSetParam (h=0x804b2a0, param=0xfef09370) at
alib/audio_lower.cpp:106
#10 0x08048e41 in main (argc=1, argv=0xfef09464) at naudiolib.cpp:160

In the other case I called SDL_Quit () before reset. and the
functions calling is as following:
SDL_Init (SDL_INIT_AUDIO);
SDL_OpenAudio (myspec, NULL);

SDL_PauseAudio (1);
SDL_CloseAudio ();
SDL_Quit ();
SDL_Init (SDL_INIT_AUDIO);
SDL_OpenAudio (newspec, NULL);
it brought out the result as:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -150611776 (LWP 5166)]
0x004911fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
(gdb) bt
#0 0x004911fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
#1 0x0046fdf4 in Arts::Dispatcher::Dispatcher () from /usr/lib/libmcop.so.1
#2 0x00119975 in arts_backend_init () from /usr/lib/libartscbackend.so.0
#3 0x0027b546 in arts_init () from /usr/lib/libartsc.so.0
#4 0x0063ffba in SDL_MixAudio_MMX_S8 () from /usr/lib/libSDL-1.2.so.0
#5 0x0063b383 in SDL_AudioInit () from /usr/lib/libSDL-1.2.so.0
#6 0x0063a31b in SDL_InitSubSystem () from /usr/lib/libSDL-1.2.so.0
#7 0x0063a397 in SDL_Init () from /usr/lib/libSDL-1.2.so.0

I wonder if this is a bug in SDL and how to fix it?

Do you have a (preferably short) source code that can reproduce the
problem ?

Stephane


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

After I updated SDL to 1.2.8,
this bug does exist any longer.On Wed, 12 Jan 2005 11:03:12 +0900, linxs <@linxs> wrote:

source: testsdl.c

#include <SDL/SDL.h>
#include <SDL/SDL_audio.h>

static void sdlcallback (void *unused, Uint8 *stream, int len)
{
}

int main () {

SDL_AudioSpec spec;

printf ("Init SDL\n");
SDL_Init (SDL_INIT_AUDIO);

spec.freq = 44100;
spec.format = AUDIO_S16LSB;
spec.channels = 2;
spec.samples = 1024 * 4;
spec.callback = sdlcallback;
spec.userdata = 0;
printf ("Open SDL\n");
SDL_OpenAudio (&spec, NULL);
printf ("Close SDL\n");
SDL_CloseAudio ();
printf ("Quit SDL\n");
SDL_Quit ();

printf ("Re-Init SDL\n");
SDL_Init (SDL_INIT_AUDIO);
printf ("Re-open SDL\n");
SDL_OpenAudio (&spec, NULL);
printf ("Close SDL\n");
SDL_CloseAudio ();
printf ("Quit SDL\n");
SDL_Quit ();

return 0;

}

compile and link: gcc -o tsdl testsdl.c -lSDL

On Tue, 11 Jan 2005 19:12:26 +0100, Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:

linxs wrote:

Hi, everybody.

I use SDL SDL-1.2.7-3 for developing application.
In my application I try to reset the paramters of audio data,
so I call the SDL functions sequently:
SDL_Init (SDL_INIT_AUDIO);
SDL_OpenAudio (myspec, NULL);

SDL_PauseAudio (1);
SDL_CloseAudio ();
SDL_OpenAudio (newspec, NULL);
It brings out the result as following:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -150652736 (LWP 5180)]
0x004851fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
(gdb) bt
#0 0x004851fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
#1 0x00463df4 in Arts::Dispatcher::Dispatcher () from /usr/lib/libmcop.so.1
#2 0x00260975 in arts_backend_init () from /usr/lib/libartscbackend.so.0
#3 0x00296546 in arts_init () from /usr/lib/libartsc.so.0
#4 0x0063ffba in SDL_MixAudio_MMX_S8 () from /usr/lib/libSDL-1.2.so.0
#5 0x0063b383 in SDL_AudioInit () from /usr/lib/libSDL-1.2.so.0
#6 0x0063a31b in SDL_InitSubSystem () from /usr/lib/libSDL-1.2.so.0
#7 0x0063b6ec in SDL_OpenAudio () from /usr/lib/libSDL-1.2.so.0
#8 0x0804922a in DrvSetParam (g=0x804b2e0, param=0xfef09370) at sdlsnd.cpp:130
#9 0x08049be1 in AudioSetParam (h=0x804b2a0, param=0xfef09370) at
alib/audio_lower.cpp:106
#10 0x08048e41 in main (argc=1, argv=0xfef09464) at naudiolib.cpp:160

In the other case I called SDL_Quit () before reset. and the
functions calling is as following:
SDL_Init (SDL_INIT_AUDIO);
SDL_OpenAudio (myspec, NULL);

SDL_PauseAudio (1);
SDL_CloseAudio ();
SDL_Quit ();
SDL_Init (SDL_INIT_AUDIO);
SDL_OpenAudio (newspec, NULL);
it brought out the result as:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -150611776 (LWP 5166)]
0x004911fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
(gdb) bt
#0 0x004911fc in Arts::StartupManager::startup () from /usr/lib/libmcop.so.1
#1 0x0046fdf4 in Arts::Dispatcher::Dispatcher () from /usr/lib/libmcop.so.1
#2 0x00119975 in arts_backend_init () from /usr/lib/libartscbackend.so.0
#3 0x0027b546 in arts_init () from /usr/lib/libartsc.so.0
#4 0x0063ffba in SDL_MixAudio_MMX_S8 () from /usr/lib/libSDL-1.2.so.0
#5 0x0063b383 in SDL_AudioInit () from /usr/lib/libSDL-1.2.so.0
#6 0x0063a31b in SDL_InitSubSystem () from /usr/lib/libSDL-1.2.so.0
#7 0x0063a397 in SDL_Init () from /usr/lib/libSDL-1.2.so.0

I wonder if this is a bug in SDL and how to fix it?

Do you have a (preferably short) source code that can reproduce the
problem ?

Stephane


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl