Cataclysm-DDA
Cataclysm-DDA copied to clipboard
"Control Doors and Curtains" vehicle option crashes the game
Describe the bug
[Window Title] Error
[Content] The program has crashed. See the log file for a stack trace. CRASH LOG FILE: J:/dda/userdata/config/crash.log VERSION: e3c105a TYPE: class std::bad_function_call MESSAGE: bad function call
[OK]
Occurs immediately when the Control Doors and Curtains" option is selected in a vehicle
Attach save file
Steps to reproduce
Enter a vehicle with a door lock or cargo lock, etc, try and interact with them
Expected behavior
No crash.
Screenshots
No response
Versions and configuration
WIndows 10 CDDA Experimental 2024-05-14-0351
Additional context
/confirm Same Issue. Happens on fresh world with default settings too. [D] "Control Doors and Curtains" Crashes the game. North Belle Vernon-trimmed.tar.gz crash.log debug.log
- OS: Windows
- OS Version: 10.0.19045.4291 (22H2)
- Game Version: e3c105a [64-bit]
- Graphics Version: Tiles
- Game Language: English [en]
- Mods loaded: [ Dark Days Ahead [dda], Disable NPC Needs [no_npc_food], Portal Storms Ignore NPCs [personal_portal_storms], Slowdown Fungal Growth [no_fungal_growth], SpeedyDex [speedydex], Stats Through Kills [stats_through_kills], Stats Through Skills [StatsThroughSkills], Aftershock [aftershock], Bombastic Perks [bombastic_perks], Bionic Slots [cbm_slots] ]
/confirm
repro here too, backtrace:
#0 0x00007f5ef91d508c in ?? () from /usr/lib64/libc.so.6
#1 0x00007f5ef9187112 in raise () from /usr/lib64/libc.so.6
#2 0x00007f5ef91704f2 in abort () from /usr/lib64/libc.so.6
#3 0x00007f5ef94a0c40 in __gnu_cxx::__verbose_terminate_handler () at /var/tmp/portage/sys-devel/gcc-13.2.1_p20240503/work/gcc-13-20240503/libstdc++-v3/libsupc++/vterminate.cc:95
#4 0x00007f5ef94b23e6 in __cxxabiv1::__terminate (handler=<optimized out>) at /var/tmp/portage/sys-devel/gcc-13.2.1_p20240503/work/gcc-13-20240503/libstdc++-v3/libsupc++/eh_terminate.cc:48
#5 0x00007f5ef94b2451 in std::terminate () at /var/tmp/portage/sys-devel/gcc-13.2.1_p20240503/work/gcc-13-20240503/libstdc++-v3/libsupc++/eh_terminate.cc:58
#6 0x00007f5ef94b2693 in __cxxabiv1::__cxa_throw (obj=<optimized out>, tinfo=0x7f5ef96522b0 <typeinfo for std::bad_function_call>, dest=0x7f5ef94dda10 <std::bad_function_call::~bad_function_call()>) at /var/tmp/portage/sys-devel/gcc-13.2.1_p20240503/work/gcc-13-20240503/libstdc++-v3/libsupc++/eh_throw.cc:98
#7 0x00007f5ef94a4017 in std::__throw_bad_function_call () at /var/tmp/portage/sys-devel/gcc-13.2.1_p20240503/work/gcc-13-20240503/libstdc++-v3/src/c++11/functional.cc:34
#8 0x0000557a65029f34 in std::function<void ()>::operator()() const (this=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/std_function.h:590
#9 operator() (__closure=<optimized out>) at ../src/veh_utils.cpp:446
#10 std::__invoke_impl<void, veh_menu::query()::<lambda()>&> (__f=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/invoke.h:61
#11 std::__invoke_r<void, veh_menu::query()::<lambda()>&> (__fn=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/invoke.h:111
#12 std::_Function_handler<void(), veh_menu::query()::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/std_function.h:290
#13 0x0000557a65029e02 in std::function<void ()>::operator()() const (this=0x7fff3167f8a8) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/std_function.h:591
#14 veh_menu_cb::select (menu=<optimized out>, this=0x7fff3167f8a0) at ../src/veh_utils.cpp:410
#15 veh_menu_cb::select (this=0x7fff3167f8a0, menu=<optimized out>) at ../src/veh_utils.cpp:394
#16 0x0000557a64fecd40 in uilist::setup (this=this@entry=0x7fff3167fa10) at ../src/ui.cpp:703
#17 0x0000557a64fece29 in uilist::reposition (this=0x7fff3167fa10, ui=...) at ../src/ui.cpp:712
#18 0x0000557a64fee575 in std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (__args#0="", this=0x557aaca5f3d8) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/std_function.h:591
#19 ui_adaptor::redraw_invalidated () at ../src/ui_manager.cpp:406
#20 0x0000557a64ff1a50 in ui_adaptor::redraw () at ../src/ui_manager.cpp:345
#21 ui_manager::redraw () at ../src/ui_manager.cpp:506
#22 uilist::query (this=0x7fff3167fa10, loop=0x1, timeout=0xffffffff) at ../src/ui.cpp:1112
#23 0x0000557a6504471a in veh_menu::query (this=0x7fff3167ff70) at ../src/veh_utils.cpp:465
#24 0x0000557a6509e80a in vehicle::control_doors (this=0x557aaccc25f0) at ../src/vehicle_use.cpp:244
#25 0x0000557a65044789 in std::function<void ()>::operator()() const (this=0x557aaccd36b8) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/std_function.h:591
#26 veh_menu::query (this=0x7fff316808a0) at ../src/veh_utils.cpp:483
#27 0x0000557a650bf9cf in vehicle::interact_with (this=0x557aaccc25f0, p=..., with_pickup=<optimized out>) at ../src/vehicle_use.cpp:2446
#28 0x0000557a646d705d in game::examine (this=0x557a67ca8500, with_pickup=0x0) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/optional:306
#29 0x0000557a6477ee0d in game::do_regular_action (this=this@entry=0x557a67ca8500, act=@0x7fff31680f64: ACTION_EXAMINE, player_character=..., mouse_target=std::optional [no contained value]) at ../src/handle_action.cpp:2351
#30 0x0000557a6477fcee in game::handle_action (this=0x557a67ca8500) at ../src/handle_action.cpp:3161
#31 0x0000557a64642631 in do_turn () at ../src/do_turn.cpp:578
#32 0x0000557a6432d1b5 in main (argc=<optimized out>, argv=<optimized out>) at ../src/main.cpp:868
looks like this was #73739. @irwiss would you be able to take a look?
we could guard calling the menu _on_select callback in the lambda added in #73739 to see if it is initialized. would this be an acceptable fix?
diff --git a/src/veh_utils.cpp b/src/veh_utils.cpp
index d27e62883c..64a0bd1d07 100644
--- a/src/veh_utils.cpp
+++ b/src/veh_utils.cpp
@@ -443,7 +443,9 @@ bool veh_menu::query()
veh_menu_cb cb( locations );
cb.on_select = [this, &menu]() {
- items[menu.selected]._on_select();
+ if( items[menu.selected]._on_select ) {
+ items[menu.selected]._on_select();
+ }
};
if( locations.size() == items.size() ) { // all items have valid location attached