Cataclysm-dda: Segmentation Fault Crash when opening inventory

Created on 5 Jun 2020  路  2Comments  路  Source: CleverRaven/Cataclysm-DDA

Describe the bug

Game crashes, providing a segmentation fault error when trying to open inventory, activate items, or any activity that utilizes items in the players inventory. this began after picking up a shoulder strap.

Steps To Reproduce

open inventory or try to activate, throw, or reload an item (or any similar action involving the player's inventory)

Expected behavior

Game should not crash upon taking the stated action

Versions and configuration

  • OS: Windows

    • OS Version: 10.0 1903

  • Game Version: 0.E-2844-gede5ff2 [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Aftershock [aftershock],
    Magiclysm [magiclysm],
    Graphical Overmap [Graphical_Overmap],
    Graphical Overmap Magiclysm [Graphical_Overmap_Magiclysm]

Additional context

<Crash / Freeze> Inventory / AIM / Zones Gunmod / Toolmod

Most helpful comment

I have a similar problem in my own game and did some investigation. In my case, if I unload a weapon that is in my inventory and then open the inventory, or if I unload a weapon to the ground and then examine the tile or list all items, I get a segfault.

I tried to reproduce in a test world but it didn't crash there, so I spawned a M4A1 in my world to compare it with my own.
The difference is that only one of them has fouling:

Screenshot_2020-06-08_11-22-55

Hence, I think this is related to #41048: unloading a weapon that was obtained before this PR seems to produce a segfault.

EDIT:
I did some more testing, and while I could fix the problem in my game by spawning new weapons from the debug menu (and destroying the old ones), this doesn't fix the shoulder strap problem.

I could however find the steps to reproduce:

  • start a new game
  • spawn a M4A1, a STANAG 10-round magazine, and a shoulder strap
  • attach the shoulder strap to the M4A1
  • reload the M4A1
  • wear the M4A1
  • save and quit
  • reload the game
  • at this point, the character will still be wearing the M4A1, however the green bars have disappeared (and the M4A1 is not a M4A1+1 anymore):
    Screenshot_2020-06-08_12-18-43
  • unload the M4A1
  • open the inventory, and get a segfault

All 2 comments

I have a similar problem in my own game and did some investigation. In my case, if I unload a weapon that is in my inventory and then open the inventory, or if I unload a weapon to the ground and then examine the tile or list all items, I get a segfault.

I tried to reproduce in a test world but it didn't crash there, so I spawned a M4A1 in my world to compare it with my own.
The difference is that only one of them has fouling:

Screenshot_2020-06-08_11-22-55

Hence, I think this is related to #41048: unloading a weapon that was obtained before this PR seems to produce a segfault.

EDIT:
I did some more testing, and while I could fix the problem in my game by spawning new weapons from the debug menu (and destroying the old ones), this doesn't fix the shoulder strap problem.

I could however find the steps to reproduce:

  • start a new game
  • spawn a M4A1, a STANAG 10-round magazine, and a shoulder strap
  • attach the shoulder strap to the M4A1
  • reload the M4A1
  • wear the M4A1
  • save and quit
  • reload the game
  • at this point, the character will still be wearing the M4A1, however the green bars have disappeared (and the M4A1 is not a M4A1+1 anymore):
    Screenshot_2020-06-08_12-18-43
  • unload the M4A1
  • open the inventory, and get a segfault

I can confirm that weapon mods are "corrupting" guns when you save and reload. They appear to not have any attachments and segfault either when unloading or after unloading and opening the inventory.

Was this page helpful?
0 / 5 - 0 ratings