CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.01k stars 4.09k forks source link

Installing certain CBMs causes crash to desktop #64036

Closed AJimmyU closed 1 year ago

AJimmyU commented 1 year ago

Describe the bug

Having Rubik install Artificial Night Generator CBM caused a crash to desktop. Installing bio_recycler also causes a crash. Removing "enchantments" entry from bio_recycler cbm stops the game from crashing.

Attach save file

bio_night https://ufile.io/vfpd3c9w

bio_recycler https://ufile.io/bbo1cqhj

Steps to reproduce

  1. Get Artificial Night Generator CBM
  2. Ask Rubik to install it
  3. Observe silent crash to desktop during the activity

Expected behavior

No crashing.

Screenshots

No response

Versions and configuration

Additional context

No response

RenechCDDA commented 1 year ago

Unable to reproduce.

image

Please provide additional details or a reproduction save.

RenechCDDA commented 1 year ago

Just for good measure I repeated until the installation failed. No crash.

image

Also tried enabling bionic slots. No crash.

AJimmyU commented 1 year ago

I have attached a savegame that crashes for me 100% of the time. https://ufile.io/vfpd3c9w

andrei8l commented 1 year ago

It only crashes with the msvc build. The other builds are fine and ASan doesn't find any issue either.

AJimmyU commented 1 year ago

Here is a second savegame where upon loading, using the autodoc next to character and installing Recycler CBM will cause a crash to desktop without any error message https://ufile.io/bbo1cqhj

I would appreciate if someone could point me in a direction of obtaining any sort of crash log for this problem.

Deleting entire "enchantments" bio_recycler entry from the bionic .json file removes the crash itself and allows the bionic to be installed normally. Readding the "enchantments" entry afterwards does not result in a crash.

akrieger commented 1 year ago

Can someone please reupload the save to gdrive or some other service that doesn't set off alarm bells from my antivirus/adblocker?

andrei8l commented 1 year ago

https://send.vis.ee/download/1ef3b7a34c3ef857/#6dahuHJvIgAaF2vIC7O_rA

andrei8l commented 1 year ago

Based on the crash log provided by akrieger, this simple patch should fix it

diff --git a/src/bionics.cpp b/src/bionics.cpp
index 48554acf89..a2434af44a 100644
--- a/src/bionics.cpp
+++ b/src/bionics.cpp
@@ -2785,6 +2785,7 @@ bionic_uid Character::add_bionic( const bionic_id &b, bionic_uid parent_uid )
         }
     }

+    invalidate_pseudo_items();
     update_bionic_power_capacity();

     calc_encumbrance();
@@ -2798,8 +2799,6 @@ bionic_uid Character::add_bionic( const bionic_id &b, bionic_uid parent_uid )
     }
     effect_on_conditions::process_reactivate( *this );

-    invalidate_pseudo_items();
-
     return bio_uid;
 }

but I don't have access to msvc to test.

rubenpd commented 1 year ago

have msvc version, this still happens, i would like to add LED tattoo CBM to the list of crashing installs

SurFlurer commented 1 year ago

but I don't have access to msvc to test.

@andrei8l I tested with this patch and can confirm that this patch works! Thank you!