Dwarf Fortress Bug Tracker - Dwarf Fortress
View Issue Details
0002617Dwarf FortressMiscellaneous Crashespublic2010-07-10 21:152010-07-10 23:11
Toady One 
x86Gentoo Linux2.6.33
0002617: Segfault on quit
After I hit quit in game menu, it reports segfault in the console:

./df: line 6: 12105 Segmentation fault ./libs/Dwarf_Fortress $*

Does not happen in 31.08 or earlier versions.
No tags attached.
related to 0003000confirmed lethosor Mac/OS X segfault when quitting game with graphics enabled 
Issue History
2010-07-10 21:15RusAnonNew Issue
2010-07-10 22:36oliverNote Added: 0009917
2010-07-10 22:38oliverIssue Monitored: oliver
2010-07-10 22:42oliverNote Added: 0009919
2010-07-10 22:51Toady OneNote Added: 0009921
2010-07-10 22:51Toady OneStatusnew => resolved
2010-07-10 22:51Toady OneFixed in Version => 0.31.10
2010-07-10 22:51Toady OneResolutionopen => fixed
2010-07-10 22:51Toady OneAssigned To => Toady One
2010-07-10 23:11oliverIssue End Monitor: oliver
2010-08-10 08:01FootkerchiefRelationship addedrelated to 0003000

2010-07-10 22:36   
Happens here too. I did some gdb work on this (the initial stacktrace isn't too useful because it crashes by trying to do an indirect call via a null pointer). Here's the culprit, the music/sound dtor:

oliver@flux:~/df_31_09/df_linux$ gdb libs/Dwarf_Fortress
GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 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 "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>... [^]
Reading symbols from /home/oliver/df_31_09/df_linux/libs/Dwarf_Fortress...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/oliver/df_31_09/df_linux/libs/Dwarf_Fortress
[Thread debugging using libthread_db enabled]
[New Thread 0xf593bb70 (LWP 3967)]
[New Thread 0xf513ab70 (LWP 3968)]
Loading bindings from data/init/interface.txt
Resetting textures

# DF window appears

Program received signal SIGINT, Interrupt.
0xf7fdf430 in __kernel_vsyscall ()
(gdb) break alcMakeContextCurrent
Breakpoint 1 at 0xf7b44c60
(gdb) cont
[Thread 0xf513ab70 (LWP 3968) exited]
[Thread 0xf593bb70 (LWP 3967) exited]

# select Quit from the main menu

Breakpoint 1, 0xf7b44c60 in alcMakeContextCurrent () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
Current language: auto
The current source language is "auto; currently asm".
(gdb) bt
#0 0xf7b44c60 in alcMakeContextCurrent () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
0000001 0xf7b45981 in musicsoundst::deinitsound() () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
0000002 0xf7b48636 in musicsoundst::~musicsoundst() () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
0000003 0xf78af728 in __cxa_finalize () from /lib32/libc.so.6
0000004 0xf7b1fb14 in __do_global_dtors_aux () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
0000005 0xf7c00b10 in _fini () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
0000006 0xf7fee996 in ?? () from /lib/ld-linux.so.2
0000007 0xf78af35f in ?? () from /lib32/libc.so.6
0000008 0xf78af3cf in exit () from /lib32/libc.so.6
0000009 0xf7896b5e in __libc_start_main () from /lib32/libc.so.6
0000010 0x0804cf31 in ?? ()
(gdb) stepi
0xf7b44c61 in alcMakeContextCurrent () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
0xf7b44c64 in alcMakeContextCurrent () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
0xf7b1fb97 in __i686.get_pc_thunk.bx () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
0xf7b1fb9a in __i686.get_pc_thunk.bx () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
0xf7b44c69 in alcMakeContextCurrent () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
0xf7b44c6f in alcMakeContextCurrent () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
0xf7b44c73 in alcMakeContextCurrent () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
0xf7b44c76 in alcMakeContextCurrent () from /home/oliver/df_31_09/df_linux/libs/libgraphics.so
0x00000000 in ?? ()
Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
2010-07-10 22:42   
musicsoundst::deinitsound() needs an "if (!functional) return;" guard at the start, in case sound is disabled or failed to link/initialize.
Toady One   
2010-07-10 22:51   
Although I'm not familiar with the file, I imagine that's similar to the if(!on)return; in the fmod version, so I'll mark this off. I've put it in there and we can see where this goes for 0.31.10. I'm unsure about the larger problems with the libraries overall.