Bug in SDL_mixer 1.2.7 - reopening does not work

Hi,

It seems that SDL_mixer 1.2.7 has problems with reopening the audio. I
have made a short sample application to demonstrate the bug. Both
SDL_Init and Mix_OpenAudio are initing correctly for the first time.

Output with 1.2.7:

az at macbook ~/Programmierung $ cat test_sdlmixer.cpp
/*
generates segfault

    compile with:
            g++ test_sdlmixer.cpp -lSDL -lSDL_mixer -o test_sdlmixer

*/

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

void submain() {
SDL_Init(SDL_INIT_AUDIO);

    Mix_OpenAudio(44100, AUDIO_S16, 1, 512);

    Mix_AllocateChannels(1000);

    Mix_CloseAudio();

    SDL_Quit();

}

int main() {
submain();
submain();

    return 0;

}
az at macbook ~/Programmierung $ g++ test_sdlmixer.cpp -lSDL -lSDL_mixer -ggdb -o
test_sdlmixer
az at macbook ~/Programmierung $ gdb test_sdlmixer
GNU gdb 6.7.1
Copyright © 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and “show warranty” for details.
This GDB was configured as “i686-pc-linux-gnu”…
Using host libthread_db library “/lib/libthread_db.so.1”.
(gdb) run
Starting program: /home/az/Programmierung/test_sdlmixer
[Thread debugging using libthread_db enabled]
[New Thread 0xb7be98e0 (LWP 3178)]
[New Thread 0xb7be8b90 (LWP 3181)]
[Thread 0xb7be8b90 (LWP 3181) exited]
[New Thread 0xb7be8b90 (LWP 3182)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7be98e0 (LWP 3178)]
0xb7e54cd4 in open_file (name=0xb7e6265f “timidity.cfg”, decompress=1,
noise_mode=2) at ./timidity/common.c:146
146 ./timidity/common.c: No such file or directory.
in ./timidity/common.c
Current language: auto; currently c
(gdb) bt
#0 0xb7e54cd4 in open_file (name=0xb7e6265f “timidity.cfg”, decompress=1,
noise_mode=2) at ./timidity/common.c:146
#1 0xb7e5ed2e in read_config_file (name=0xb7e6265f “timidity.cfg”)
at ./timidity/timidity.c:63
#2 0xb7e5f8e2 in Timidity_Init (rate=44100, format=32784, channels=1,
samples=512) at ./timidity/timidity.c:297
#3 0xb7e538ab in open_music (mixer=0xb7e6c164) at ./music.c:438
#4 0xb7e5207b in Mix_OpenAudio (frequency=44100, format=32784,
nchannels=, chunksize=512) at ./mixer.c:304
#5 0x08048696 in submain () at test_sdlmixer.cpp:14
#6 0x080486c9 in main () at test_sdlmixer.cpp:25
(gdb) q
The program is running. Exit anyway? (y or n) y
az at macbook ~/Programmierung $--------------------

Output with 1.2.8:

az at macbook ~/Programmierung $ g++ test_sdlmixer.cpp -lSDL -lSDL_mixer -ggdb -o
test_sdlmixer
az at macbook ~/Programmierung $ gdb test_sdlmixer
GNU gdb 6.7.1
Copyright © 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and “show warranty” for details.
This GDB was configured as “i686-pc-linux-gnu”…
Using host libthread_db library “/lib/libthread_db.so.1”.
(gdb) run
Starting program: /home/az/Programmierung/test_sdlmixer
[Thread debugging using libthread_db enabled]
[New Thread 0xb7c228e0 (LWP 15127)]
[New Thread 0xb7c21b90 (LWP 15130)]
[Thread 0xb7c21b90 (LWP 15130) exited]
[New Thread 0xb7c21b90 (LWP 15131)]
[Thread 0xb7c21b90 (LWP 15131) exited]

Program exited normally.
(gdb) q
az at macbook ~/Programmierung $


I posted the bug also on the Gentoo bugtracker:
http://bugs.gentoo.org/show_bug.cgi?id=207051

Regards,
Albert