Closed CypherHyena closed 3 years ago
Can't reproduce on 0.F-1785-g5857e10afe
. Cutting the towels, whether they be wet or not, gave me 3 patchwork cotton clothing parts per towel. Same result with cutting the from the butcher menu.
My game version is from yesterday, so maybe it's a very recent bug? Since yours is from today.
Couldn't reproduce at 1f0d81eb62f08d355ac41985cba7f3e9989aa29e. Towels got cut up into patchwork cotton. Can you upload a save file?
I was just able to reproduce it again. I made a save file before the crash.
Steps to Reproduce.
LoadGame -> Helton -> Cypher
Press A (Activate)
Press Enter (scissors)
Press 2 (Cut up an item)
Press Enter (Select the nearby towel)
manual_backup.zip
This is a backup of my save. If you need my whole folder zipped up let me know.
I can reproduce the crash in the save file you provided.
Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ff69d3bceea in Item_factory::find_template(string_id<itype> const&) const ()
(gdb) bt
#0 0x00007ff69d3bceea in Item_factory::find_template(string_id<itype> const&) const ()
#1 0x00007ff69d3bd1c5 in string_id<itype>::obj() const ()
#2 0x00007ff69d44d18f in salvage_actor::cut_up(Character&, item&, item_location&) const ()
#3 0x00007ff69d44dc6d in salvage_actor::use(Character&, item&, bool, tripoint const&) const ()
#4 0x00007ff69d3e43d0 in use_function::call(Character&, item&, bool, tripoint const&) const ()
#5 0x00007ff69d3deb4b in itype::invoke(Character&, item&, tripoint const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const ()
#6 0x00007ff69d140809 in Character::invoke_item(item*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, tripoint const&, int) ()
#7 0x00007ff69d0984ae in avatar::invoke_item(item*, tripoint const&, int) ()
#8 0x00007ff69d145c62 in Character::use(item_location, int) ()
#9 0x00007ff69d0a400e in avatar_action::use_item(avatar&, item_location&) ()
#10 0x00007ff69d0a4189 in avatar_action::use_item(avatar&) ()
#11 0x00007ff69d2e08f3 in game::do_regular_action(action_id&, avatar&, cata::optional<tripoint> const&) ()
#12 0x00007ff69d2e5085 in game::handle_action() ()
#13 0x00007ff69d1f7c34 in do_turn() ()
#14 0x00007ff69de7eca8 in main ()
The segfault seems to happen inside this loop:
auto iter = std::find_if( recipe_dict.begin(),
recipe_dict.end(), [&]( const std::pair<const recipe_id, recipe> &curr ) {
units::mass weight = 0_gram;
for( const auto &altercomps : curr.second.simple_requirements().get_components() ) {
const item_comp &foo = altercomps.front();
weight += ( altercomps.front().type->weight ) * altercomps.front().count;
}
return !curr.second.obsolete && curr.second.result() == temp.typeId() &&
curr.second.makes_amount() <= 1 && weight <= temp.weight();
} );
After adding some debug prints (recipe-id and itype_id of each component) I got:
...
recipe_id=crossbow_trap
type=string_36
type=crossbow
type=bolt_steel
recipe_id=shotgun_trap
type=string_36
Segmentation fault
Looks like the segfault is triggered by the 2nd component of the shotgun_trap
recipe, which is slamfire_shotgun_d
.
The "Generic Guns" mod overrides this item, which might be the source of the problem.
Come to think of it, this world in which I'm crashing is the first I created with Generic Guns activated. This very well could be the source of the crash.
After removing that mod from your save file's "mods.json" I was able to cut up the towel. Now, while disabling that mod may function as a workaround, we still have a real bug in the code that could be triggered by other bad JSON definitions or weird mod interactions. I'll continue looking for a fix.
Looking at the history of iuse_actor.cpp
the most likely change to have caused this bug is #50463.
Edit: Confirmed Game built at a1fc9abe7786a7e45e5894aa120beb3be61d1d0f (before that change) doesn't crash when cutting a towel. Game built at eed09b9e80bdf26abbc5ba6732d1183d2a4e4401 (PR #50463) does crash.
Still unclear if that PR introduced the bug or merely exposed it.
@CypherHyena, could you edit the issue description to mention that the "Generic Guns" mod is necessary to trigger the bug? Cutting a towel or pretty much any object that wasn't crafted with any cutting tool while that mod is active will cause a crash.
Alright, the good news is I have a fix for this issue so you won't have to restart the game or ditch that mod. ~The bad news is the fix doesn't address the root cause, so this could still happen under some conditions (just much less likely).~ Edit: Never mind, figured out the root cause as well.
Describe the bug
This is happening with the following
Steps To Reproduce
Expected behavior
Towels are cut up into rags.
Screenshots
No response
Versions and configuration
Additional context
No Crash.log was generated.
Debug.Log
20:28:18.321 : Starting log. 20:28:18.321 INFO : Cataclysm DDA version 86ff040 20:28:18.328 INFO : [main] C locale set to C 20:28:18.328 INFO : [main] C++ locale set to C 20:28:18.328 INFO : SDL version used during compile is 2.0.14 20:28:18.328 INFO : SDL version used during linking and in runtime is 2.0.14 20:28:18.527 INFO : Number of render drivers on your system: 5 20:28:18.527 INFO : Render driver: 0/direct3d 20:28:18.527 INFO : Render driver: 1/direct3d11 20:28:18.527 INFO : Render driver: 2/opengl 20:28:18.527 INFO : Render driver: 3/opengles2 20:28:18.527 INFO : Render driver: 4/software 20:28:18.531 INFO : [options] C locale set to C 20:28:18.531 INFO : [options] C++ locale set to C 20:28:18.531 INFO : Setting language to: 'en' 20:28:18.531 INFO : Language is set to: 'en' 20:28:18.531 INFO : [translations] C locale set to English_United States.1252 20:28:18.531 INFO : [translations] C++ locale set to C 20:28:18.706 INFO : Active renderer: 1/direct3d11 20:28:18.839 INFO : USE_COLOR_MODULATED_TEXTURES is set to 0 20:28:18.902 INFO : Setting language to: 'en' 20:28:18.902 INFO : Language is set to: 'en' 20:28:18.902 INFO : [translations] C locale set to English_United States.1252 20:28:18.902 INFO : [translations] C++ locale set to C 20:28:40.966 WARNING : opendir [./save/Helton/mods] failed with "No such file or directory". 20:29:03.623 INFO : Loaded tileset: UNDEAD_PEOPLE_BASE