-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent segfault when target of firstaid_activity_actor disappears #75310
Prevent segfault when target of firstaid_activity_actor disappears #75310
Conversation
I would never have guessed the canning pot was causing it, thats amazing, thank you so much for sporting it!!! |
Also for the canning pot in my inventory , its the pack frame that lets you strap a single big container item, in this case the canning pot I was using as a makeshift backpack. |
Prevents segfault when performing `firstaid_activity_actor` but the bandage tool disappeared. Backtrace of fixed segfault: ``` Thread 1 "cataclysm-tiles" received signal SIGSEGV, Segmentation fault. (gdb) bt #0 0x0000555555ece5a4 in item::get_usable_item_helper<item> (use_name="heal", self=...) at src/item.cpp:11584 CleverRaven#1 item::get_usable_item (this=0x0, use_name="heal") at src/item.cpp:11606 CleverRaven#2 0x000055555599c6bf in firstaid_activity_actor::finish (this=0x55559b583f20, act=..., who=...) at src/activity_actor.cpp:6651 CleverRaven#3 0x00005555564d8c6b in player_activity::do_turn (this=0x555558108218, you=...) at src/player_activity.cpp:391 CleverRaven#4 0x0000555555ce3fa6 in do_turn () at src/do_turn.cpp:532 CleverRaven#5 0x000055555577511a in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873 ``` An example where this happened was when the bandage was inside a spillable container (clay canning pot), that spilled its contents when starting the activity. Spiling the clay canning pot invalidates the `item_location`. Backtrace of when the clay canning pot was spilled: ``` #0 item_pocket::get_name (this=0x555557fa7540) at src/item_pocket.cpp:2117 CleverRaven#1 item_pocket::handle_liquid_or_spill (this=this@entry=0x555557fa7540, guy=..., avoid=0x555557fa8060) at src/item_pocket.cpp:806 CleverRaven#2 0x0000555555a6aa60 in avatar_action::use_item (you=..., loc=..., method="heal") at src/avatar_action.cpp:1212 CleverRaven#3 0x0000555555a6dda7 in avatar_action::eat_or_use (you=..., loc=...) at src/avatar_action.cpp:988 CleverRaven#4 0x0000555555e3e1c5 in game::do_regular_action (this=this@entry=0x555557f94a60, act=@0x7fffffffd1b0: ACTION_EAT, player_character=..., mouse_target=std::optional [no contained value]) at src/handle_action.cpp:2479 CleverRaven#5 0x0000555555e41260 in game::handle_action (this=0x555557f94a60) at src/handle_action.cpp:3176 CleverRaven#6 0x0000555555ce422f in do_turn () at /usr/include/c++/13/bits/unique_ptr.h:199 CleverRaven#7 0x000055555577511a in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873 ```
9ea5f44
to
6172c11
Compare
@inogenous Looks like this could use a backport, #75689 appears to have the same stack trace on a 0.H release candidate? |
Awesome, thanks @RenechCDDA for the ping! Have backported the change in #75691 . |
Summary
Bugfixes "Prevent segfault when target of firstaid_activity_actor disappears"
Purpose of change
Prevents segfault when performing
firstaid_activity_actor
but the bandage tool disappeared. Fixes #75309 .Describe the solution
Backtrace of fixed segfault:
An example where this happened was when the bandage was inside a spillable container (clay canning pot), that spilled its contents when starting the activity. Spiling the clay canning pot invalidates the
item_location
. Backtrace of when the clay canning pot was spilled:Describe alternatives you've considered
Having the bandages inside the clay canning pot like that should not be possible since the clay canning pot is a spillable container, but apparently it is, and that's possibly a separate issue. Wielding the clay canning pot should be ok, since that wouldnt spill it, but having it inside the inventory like that causes the issue. Maybe autopickup placed them inside the spillable container? It's possibly a separate issue to prevent this in the first place.
Testing
When performing the steps in #75309 , the segfault can longer be reproduced. Instead, it shows the debugmsg "Lost tool used for healing".
Additional context