SDL_Quit call causing crash

Hi,
I have initialized SDL library using library function call SDL_Init() and then create a mutex and condition variable.

mutex=SDL_CreateMutex(); //SDL_mutex *mutex;
cond=SDL_CreateCond(); //SDL_cond *cond;

and at the end of program, I am destroying the mutex & conditional variable and shuting down the SDL subsystem as follows:
//--------------
SDL_DestroyMutex(mutex);
SDL_DestroyCond(cond);
SDL_Quit();
//--------------

Call to SDL_DestroyMutex() & SDL_DestroyCond() is successfull but call to SDL_Quit() causing crash.
Can someone please point out why SDL_Quit() is causing crash? Thanks in advance.

Here is the message generated by program at the end.------------------
munmap_chunk(): invalid pointer: 0x09f66d18 ***
======= Backtrace: =========
/lib/libc.so.6(cfree+0x1bb)[0xac267b]
/usr/lib/libSDL-1.2.so.0(SDL_AudioQuit+0x65)[0x20479b5]
/usr/lib/libSDL-1.2.so.0(SDL_QuitSubSystem+0x7c)[0x2046eec]
/usr/lib/libSDL-1.2.so.0(SDL_Quit+0x1e)[0x2046f4e]
/home/fortuna/workspace/mp3streamplaywithparser/Debug/mp3streamplaywithparser[0x804a6f4]
/home/fortuna/workspace/mp3streamplaywithparser/Debug/mp3streamplaywithparser[0x804a257]
/lib/libc.so.6(__libc_start_main+0xdc)[0xa6ef2c]
/home/fortuna/workspace/mp3streamplaywithparser/Debug/mp3streamplaywithparser[0x80494d1]
======= Memory map: ========
00110000-00553000 r-xp 00000000 fd:00 3890526 /usr/local/lib/libavcodec.so.51.25.0
00553000-00559000 rwxp 00442000 fd:00 3890526 /usr/local/lib/libavcodec.so.51.25.0
00559000-005bf000 rwxp 00559000 00:00 0
005bf000-005cc000 r-xp 00000000 fd:00 3890513 /usr/local/lib/libfaac.so.0.0.0
005cc000-005cf000 rwxp 0000d000 fd:00 3890513 /usr/local/lib/libfaac.so.0.0.0
005d0000-005ec000 r-xp 00000000 fd:00 3888847 /usr/lib/libvorbis.so.0.3.1
005ec000-005fa000 rwxp 0001c000 fd:00 3888847 /usr/lib/libvorbis.so.0.3.1
005fa000-005ff000 r-xp 00000000 fd:00 3888522 /usr/lib/libogg.so.0.5.3
005ff000-00600000 rwxp 00004000 fd:00 3888522 /usr/lib/libogg.so.0.5.3
00600000-00609000 r-xp 00000000 fd:00 17367081 /lib/libnss_files-2.5.so
00609000-0060a000 r-xp 00008000 fd:00 17367081 /lib/libnss_files-2.5.so
0060a000-0060b000 rwxp 00009000 fd:00 17367081 /lib/libnss_files-2.5.so
0065e000-0065f000 r-xp 0065e000 00:00 0 [vdso]
0065f000-0066a000 r-xp 00000000 fd:00 3889262 /usr/lib/libvorbisenc.so.2.0.2
0066a000-00759000 rwxp 0000a000 fd:00 3889262 /usr/lib/libvorbisenc.so.2.0.2
00759000-0075b000 rwxp 00759000 00:00 0
00829000-008b3000 r-xp 00000000 fd:00 3890530 /usr/local/lib/libavformat.so.51.6.0
008b3000-008b8000 rwxp 00089000 fd:00 3890530 /usr/local/lib/libavformat.so.51.6.0
00a3c000-00a55000 r-xp 00000000 fd:00 17368698 /lib/ld-2.5.so
00a55000-00a56000 r-xp 00018000 fd:00 17368698 /lib/ld-2.5.so
00a56000-00a57000 rwxp 00019000 fd:00 17368698 /lib/ld-2.5.so
00a59000-00b90000 r-xp 00000000 fd:00 17368699 /lib/libc-2.5.so
00b90000-00b92000 r-xp 00137000 fd:00 17368699 /lib/libc-2.5.so
00b92000-00b93000 rwxp 00139000 fd:00 17368699 /lib/libc-2.5.so
00b93000-00b96000 rwxp 00b93000 00:00 0
00b98000-00bbd000 r-xp 00000000 fd:00 17368706 /lib/libm-2.5.so
00bbd000-00bbe000 r-xp 00024000 fd:00 17368706 /lib/libm-2.5.so
00bbe000-00bbf000 rwxp 00025000 fd:00 17368706 /lib/libm-2.5.so
00bc1000-00bc3000 r-xp 00000000 fd:00 17368700 /lib/libdl-2.5.so
00bc3000-00bc4000 r-xp 00001000 fd:00 17368700 /lib/libdl-2.5.so
00bc4000-00bc5000 rwxp 00002000 fd:00 17368700 /lib/libdl-2.5.so
00bc7000-00bda000 r-xp 00000000 fd:00 17368701 /lib/libpthread-2.5.so
00bda000-00bdb000 r-xp 00012000 fd:00 17368701 /lib/libpthread-2.5.so
00bdb000-00bdc000 rwxp 00013000 fd:00 17368701 /lib/libpthread-2.5.so
00bdc000-00bde000 rwxp 00bdc000 00:00 0
00be0000-00bf2000 r-xp 00000000 fd:00 3893122 /usr/lib/libz.so.1.2.3
00bf2000-00bf3000 rwxp 00011000 fd:00 3893122 /usr/lib/libz.so.1.2.3
00eac000-00eb1000 r-xp 00000000 fd:00 3890522 /usr/local/lib/libavutil.so.49.1.0
00eb1000-00eb2000 rwxp 00004000 fd:00 3890522 /usr/local/lib/libavutil.so.49.1.0
02041000-020bd000 r-xp 00000000 fd:00 3897545 /usr/lib/libSDL-1.2.so.0.7.3
020bd000-020bf000 rwxp 0007c000 fd:00 3897545 /usr/lib/libSDL-1.2.so.0.7.3
020bf000-020ea000 rwxp 020bf000 00:00 0
05ee3000-05fb9000 r-xp 00000000 fd:00 17368719 /lib/libasound.so.2.0.0
05fb9000-05fbe000 rwxp 000d5000 fd:00 17368719 /lib/libasound.so.2.0.0
06055000-0607d000 r-xp 00000000 fd:00 3893166 /usr/lib/libaudiofile.so.0.0.2
0607d000-06080000 rwxp 00027000 fd:00 3893166 /usr/lib/libaudiofile.so.0.0.2
06136000-0613f000 r-xp 00000000 fd:00 3893167 /usr/lib/libesd.so.0.2.36
0613f000-06140000 rwxp 00009000 fd:00 3893167 /usr/lib/libesd.so.0.2.36
067e9000-067f4000 r-xp 00000000 fd:00 17368721 /lib/libgcc_s-4.1.1-20061011.so.1
067f4000-067f5000 rwxp 0000a000 fd:00 17368721 /lib/libgcc_s-4.1.1-20061011.so.1
08048000-0805c000 r-xp 00000000 fd:00 11895124 /home/fortuna/workspace/mp3streamplaywithparser/Debug/mp3streamplaywithparser
0805c000-0805d000 rw-p 00013000 fd:00 11895124 /home/fortuna/workspace/mp3streamplaywithparser/Debug/mp3streamplaywithparser
0805d000-0805e000 rw-p 0805d000 00:00 0
09f4b000-09f8f000 rw-p 09f4b000 00:00 0
b7480000-b74a2000 rw-p b7480000 00:00 0
b74a2000-b74a3000 —p b74a2000 00:00 0
b74a3000-b7ea3000 rw-p b74a3000 00:00 0
b7ea3000-b7ec3000 rw-s 00000000 00:08 6651921 /SYSV0056a4d6 (deleted)
b7ef2000-b7ef6000 rw-p b7ef2000 00:00 0
b7f00000-b7f10000 rw-s 00000000 00:10 4024 /dev/snd/pcmC0D0p
b7f10000-b7f11000 rw-s 81000000 00:10 4024 /dev/snd/pcmC0D0p
b7f11000-b7f12000 r–s 80000000 00:10 4024 /dev/snd/pcmC0D0p
b7f12000-b7f13000 rw-s 00000000 00:08 6619149 /SYSV0056a4d5 (deleted)
b7f13000-b7f14000 rw-p b7f13000 00:00 0
bfe3f000-bfe54000 rw-p bfe3f000 00:00 0 [stack]

Regards,
Sanjay

Actually, I keep getting the same error!
I’ve been wondering about that…
I don’t get the same error message though.

I’m using the Linux version of the library…

/ChrisOn 20 Mar 2007 14:24:06 -0000, sanjay kumar gupta wrote:

Hi,
I have initialized SDL library using library function call SDL_Init() and
then create a mutex and condition variable.

mutex=SDL_CreateMutex(); //SDL_mutex *mutex;
cond=SDL_CreateCond(); //SDL_cond *cond;

and at the end of program, I am destroying the mutex & conditional
variable and shuting down the SDL subsystem as follows:
//--------------
SDL_DestroyMutex(mutex);
SDL_DestroyCond(cond);
SDL_Quit();
//--------------

Call to SDL_DestroyMutex() & SDL_DestroyCond() is successfull but call to
SDL_Quit() causing crash.
Can someone please point out why SDL_Quit() is causing crash? Thanks in
advance.

Here is the message generated by program at the end.

munmap_chunk(): invalid pointer: 0x09f66d18 ***
======= Backtrace: =========
/lib/libc.so.6(cfree+0x1bb)[0xac267b]
/usr/lib/libSDL-1.2.so.0(SDL_AudioQuit+0x65)[0x20479b5]
/usr/lib/libSDL-1.2.so.0(SDL_QuitSubSystem+0x7c)[0x2046eec]
/usr/lib/libSDL-1.2.so.0(SDL_Quit+0x1e)[0x2046f4e]

/home/fortuna/workspace/mp3streamplaywithparser/Debug/mp3streamplaywithparser[0x804a6f4]

/home/fortuna/workspace/mp3streamplaywithparser/Debug/mp3streamplaywithparser[0x804a257]
/lib/libc.so.6(__libc_start_main+0xdc)[0xa6ef2c]

/home/fortuna/workspace/mp3streamplaywithparser/Debug/mp3streamplaywithparser[0x80494d1]
======= Memory map: ========
00110000-00553000 r-xp 00000000 fd:00 3890526
/usr/local/lib/libavcodec.so.51.25.0
00553000-00559000 rwxp 00442000 fd:00 3890526
/usr/local/lib/libavcodec.so.51.25.0
00559000-005bf000 rwxp 00559000 00:00 0
005bf000-005cc000 r-xp 00000000 fd:00 3890513
/usr/local/lib/libfaac.so.0.0.0
005cc000-005cf000 rwxp 0000d000 fd:00 3890513
/usr/local/lib/libfaac.so.0.0.0
005d0000-005ec000 r-xp 00000000 fd:00 3888847
/usr/lib/libvorbis.so.0.3.1
005ec000-005fa000 rwxp 0001c000 fd:00 3888847
/usr/lib/libvorbis.so.0.3.1
005fa000-005ff000 r-xp 00000000 fd:00 3888522 /usr/lib/libogg.so.0.5.3
005ff000-00600000 rwxp 00004000 fd:00 3888522 /usr/lib/libogg.so.0.5.3
00600000-00609000 r-xp 00000000 fd:00 17367081 /lib/libnss_files-2.5.so
00609000-0060a000 r-xp 00008000 fd:00 17367081 /lib/libnss_files-2.5.so
0060a000-0060b000 rwxp 00009000 fd:00 17367081 /lib/libnss_files-2.5.so
0065e000-0065f000 r-xp 0065e000 00:00 0 [vdso]
0065f000-0066a000 r-xp 00000000 fd:00 3889262
/usr/lib/libvorbisenc.so.2.0.2
0066a000-00759000 rwxp 0000a000 fd:00 3889262
/usr/lib/libvorbisenc.so.2.0.2
00759000-0075b000 rwxp 00759000 00:00 0
00829000-008b3000 r-xp 00000000 fd:00 3890530
/usr/local/lib/libavformat.so.51.6.0
008b3000-008b8000 rwxp 00089000 fd:00 3890530
/usr/local/lib/libavformat.so.51.6.0
00a3c000-00a55000 r-xp 00000000 fd:00 17368698 /lib/ld-2.5.so
00a55000-00a56000 r-xp 00018000 fd:00 17368698 /lib/ld-2.5.so
00a56000-00a57000 rwxp 00019000 fd:00 17368698 /lib/ld-2.5.so
00a59000-00b90000 r-xp 00000000 fd:00 17368699 /lib/libc-2.5.so
00b90000-00b92000 r-xp 00137000 fd:00 17368699 /lib/libc-2.5.so
00b92000-00b93000 rwxp 00139000 fd:00 17368699 /lib/libc-2.5.so
00b93000-00b96000 rwxp 00b93000 00:00 0
00b98000-00bbd000 r-xp 00000000 fd:00 17368706 /lib/libm-2.5.so
00bbd000-00bbe000 r-xp 00024000 fd:00 17368706 /lib/libm-2.5.so
00bbe000-00bbf000 rwxp 00025000 fd:00 17368706 /lib/libm-2.5.so
00bc1000-00bc3000 r-xp 00000000 fd:00 17368700 /lib/libdl-2.5.so
00bc3000-00bc4000 r-xp 00001000 fd:00 17368700 /lib/libdl-2.5.so
00bc4000-00bc5000 rwxp 00002000 fd:00 17368700 /lib/libdl-2.5.so
00bc7000-00bda000 r-xp 00000000 fd:00 17368701 /lib/libpthread-2.5.so
00bda000-00bdb000 r-xp 00012000 fd:00 17368701 /lib/libpthread-2.5.so
00bdb000-00bdc000 rwxp 00013000 fd:00 17368701 /lib/libpthread-2.5.so
00bdc000-00bde000 rwxp 00bdc000 00:00 0
00be0000-00bf2000 r-xp 00000000 fd:00 3893122 /usr/lib/libz.so.1.2.3
00bf2000-00bf3000 rwxp 00011000 fd:00 3893122 /usr/lib/libz.so.1.2.3
00eac000-00eb1000 r-xp 00000000 fd:00 3890522
/usr/local/lib/libavutil.so.49.1.0
00eb1000-00eb2000 rwxp 00004000 fd:00 3890522
/usr/local/lib/libavutil.so.49.1.0
02041000-020bd000 r-xp 00000000 fd:00 3897545 /usr/lib/libSDL-
1.2.so.0.7.3
020bd000-020bf000 rwxp 0007c000 fd:00 3897545 /usr/lib/libSDL-
1.2.so.0.7.3
020bf000-020ea000 rwxp 020bf000 00:00 0
05ee3000-05fb9000 r-xp 00000000 fd:00 17368719 /lib/libasound.so.2.0.0
05fb9000-05fbe000 rwxp 000d5000 fd:00 17368719 /lib/libasound.so.2.0.0
06055000-0607d000 r-xp 00000000 fd:00 3893166
/usr/lib/libaudiofile.so.0.0.2
0607d000-06080000 rwxp 00027000 fd:00 3893166
/usr/lib/libaudiofile.so.0.0.2
06136000-0613f000 r-xp 00000000 fd:00 3893167 /usr/lib/libesd.so.0.2.36
0613f000-06140000 rwxp 00009000 fd:00 3893167 /usr/lib/libesd.so.0.2.36
067e9000-067f4000 r-xp 00000000 fd:00 17368721 /lib/libgcc_s-
4.1.1-20061011.so.1
067f4000-067f5000 rwxp 0000a000 fd:00 17368721 /lib/libgcc_s-
4.1.1-20061011.so.1
08048000-0805c000 r-xp 00000000 fd:00 11895124
/home/fortuna/workspace/mp3streamplaywithparser/Debug/mp3streamplaywithparser
0805c000-0805d000 rw-p 00013000 fd:00 11895124
/home/fortuna/workspace/mp3streamplaywithparser/Debug/mp3streamplaywithparser
0805d000-0805e000 rw-p 0805d000 00:00 0
09f4b000-09f8f000 rw-p 09f4b000 00:00 0
b7480000-b74a2000 rw-p b7480000 00:00 0
b74a2000-b74a3000 —p b74a2000 00:00 0
b74a3000-b7ea3000 rw-p b74a3000 00:00 0
b7ea3000-b7ec3000 rw-s 00000000 00:08 6651921 /SYSV0056a4d6 (deleted)
b7ef2000-b7ef6000 rw-p b7ef2000 00:00 0
b7f00000-b7f10000 rw-s 00000000 00:10 4024 /dev/snd/pcmC0D0p
b7f10000-b7f11000 rw-s 81000000 00:10 4024 /dev/snd/pcmC0D0p
b7f11000-b7f12000 r–s 80000000 00:10 4024 /dev/snd/pcmC0D0p
b7f12000-b7f13000 rw-s 00000000 00:08 6619149 /SYSV0056a4d5 (deleted)
b7f13000-b7f14000 rw-p b7f13000 00:00 0
bfe3f000-bfe54000 rw-p bfe3f000 00:00 0 [stack]

Regards,
Sanjay

[image: Diageo]<http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signature-home.htm/1050715198 at Middle5/1119380_1113690/1118605/1?PARTNER=3&OAS_QUERY=null+target=new+>


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GIT d? s-: a— C>$ UL+++>$ P L+++>$ !E— !W+++>$ !N o? K–? !w-- !O----
!M>$ !V? PS+(+++)@ !PE Y++ !PGP? t++ !5? X++ !R tv–? b+>$ DI D+ G e h !r
!y*
------END GEEK CODE BLOCK------