I just found another rare crash. Widelands crashes in Map_Map_Object_Saver::get_object_record() because it is called from Cmd_EnemyFlagAction::Write() with a &obj = NULL. I think this happens in the following case:
1. Cmd_EnemyFlagAction is enqueued
2. MapObject (Flag?) is destroyed
3. Game is saved before the Command get executed.
Maybe this can happen for other commands too.
gdb output:
Game: Writing Map Data done!
Game: Writing Player Economies Info ... done
Game: Writing Command Queue Data ... nwritten: 1764
Program received signal SIGSEGV, Segmentation fault.
Widelands::Map_Map_Object_Saver::get_object_record (this=0x2f0e4f38, obj=...) at /home/timo/widelands/trunk/src/map_io/widelands_map_map_object_saver.cc:60
60 rec.description = obj.type_name();
(gdb) bt full 2
#0 Widelands::Map_Map_Object_Saver::get_object_record (this=0x2f0e4f38, obj=...) at /home/timo/widelands/trunk/src/map_io/widelands_map_map_object_saver.cc:60
rec = {description = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x2dbee1b0 "H\376I\b\333\071\361\016\004"}}, fileserial = 4156030927,
registered = 148, saved = 148}
#1 0x08358d98 in Widelands::Map_Map_Object_Saver::get_object_file_index (this=0x2f0e4f38, obj=...) at /home/timo/widelands/trunk/src/map_io/widelands_map_map_object_saver.cc:123
No locals.
(More stack frames follow...)
(gdb) bt
#0 Widelands::Map_Map_Object_Saver::get_object_record (this=0x2f0e4f38, obj=...) at /home/timo/widelands/trunk/src/map_io/widelands_map_map_object_saver.cc:60
#1 0x08358d98 in Widelands::Map_Map_Object_Saver::get_object_file_index (this=0x2f0e4f38, obj=...) at /home/timo/widelands/trunk/src/map_io/widelands_map_map_object_saver.cc:123
#2 0x081a34d7 in Widelands::Cmd_EnemyFlagAction::Write (this=0x2dbee1b0, fw=..., egbase=..., mos=...) at /home/timo/widelands/trunk/src/logic/playercommand.cc:1246
#3 0x08324f65 in Widelands::Game_Cmd_Queue_Data_Packet::Write (this=0xffff9534, fs=..., game=..., os=0x2f0e4f38) at /home/timo/widelands/trunk/src/game_io/game_cmd_queue_data_packet.cc:123
#4 0x0832115d in Widelands::Game_Saver::save (this=0xffff9580) at /home/timo/widelands/trunk/src/game_io/game_saver.cc:70
#5 0x081509d0 in SaveHandler::save_game (this=0xffff9a20, game=..., complete_filename=..., error=0x85722a8) at /home/timo/widelands/trunk/src/save_handler.cc:155
#6 0x08150c2b in SaveHandler::think (this=0xffff9a20, game=..., realtime=10762433) at /home/timo/widelands/trunk/src/save_handler.cc:69
#7 0x0819377d in Widelands::Game::think (this=0xffff987c) at /home/timo/widelands/trunk/src/logic/game.cc:570
#8 0x082c2b7e in Interactive_Base::think (this=0x1883d878) at /home/timo/widelands/trunk/src/wui/interactive_base.cc:332
#9 0x0817ae28 in UI::Panel::do_think (this=0x1883d878) at /home/timo/widelands/trunk/src/ui_basic/panel.cc:542
#10 0x0817ca71 in UI::Panel::run (this=0x1883d878) at /home/timo/widelands/trunk/src/ui_basic/panel.cc:174
#11 0x081980a4 in Widelands::Game::run (this=0xffff987c, loader_ui=..., start_game_type=Widelands::Game::NewNonScenario) at /home/timo/widelands/trunk/src/logic/game.cc:535
#12 0x081591a0 in NetHost::run (this=0xffffb248, autorun=false) at /home/timo/widelands/trunk/src/network/nethost.cc:653
#13 0x0812d52b in WLApplication::mainmenu_multiplayer (this=0x858d228) at /home/timo/widelands/trunk/src/wlapplication.cc:1695
#14 0x081331ce in WLApplication::mainmenu (this=0x858d228) at /home/timo/widelands/trunk/src/wlapplication.cc:1480
#15 0x08133745 in WLApplication::run (this=0x858d228) at /home/timo/widelands/trunk/src/wlapplication.cc:419
#16 0x08129cb1 in main (argc=1, argv=0xffffd294) at /home/timo/widelands/trunk/src/main.cc:48
(gdb) bt full 4
#0 Widelands::Map_Map_Object_Saver::get_object_record (this=0x2f0e4f38, obj=...) at /home/timo/widelands/trunk/src/map_io/widelands_map_map_object_saver.cc:60
rec = {description = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x2dbee1b0 "H\376I\b\333\071\361\016\004"}}, fileserial = 4156030927,
registered = 148, saved = 148}
#1 0x08358d98 in Widelands::Map_Map_Object_Saver::get_object_file_index (this=0x2f0e4f38, obj=...) at /home/timo/widelands/trunk/src/map_io/widelands_map_map_object_saver.cc:123
No locals.
#2 0x081a34d7 in Widelands::Cmd_EnemyFlagAction::Write (this=0x2dbee1b0, fw=..., egbase=..., mos=...) at /home/timo/widelands/trunk/src/logic/playercommand.cc:1246
obj = <value optimized out>
#3 0x08324f65 in Widelands::Game_Cmd_Queue_Data_Packet::Write (this=0xffff9534, fs=..., game=..., os=0x2f0e4f38) at /home/timo/widelands/trunk/src/game_io/game_cmd_queue_data_packet.cc:123
cmd = <value optimized out>
fw = {<Widelands::StreamWrite> = {<StreamWrite> = {_vptr.StreamWrite = 0x84c5d38}, <No data fields>}, data = 0x2fb158c8 "\002", filelength = 177547, maxsize = 180224, filepos = {pos = 177547}}
(More stack frames follow...)
(gdb) print &obj
$1 = (const Widelands::Map_Object *) 0x0
The approach to not write the package if the object has vanished seems like a good one to me. Why didn't you apply this patch?