Skip to content

Fix fireworks crafting crash#1085

Open
Alezito2008 wants to merge 1 commit intosmartcmd:mainfrom
Alezito2008:fix/fireworks-crafting-crash
Open

Fix fireworks crafting crash#1085
Alezito2008 wants to merge 1 commit intosmartcmd:mainfrom
Alezito2008:fix/fireworks-crafting-crash

Conversation

@Alezito2008
Copy link
Contributor

Description

Fixed a read access violation crash occurring during the fireworks crafting process due to unstable memory management in FireworksRecipe

Changes

Previous Behavior

The game would crash when trying to craft fireworks

Root Cause

The FireworksRecipe used Thread Local Storage to temporarily store the resultItem. Because the crafting validation (matches()) and the actual item generation (assemble()) were called from different thread contexts, the TLS would return a nullptr. Attempting to call copy() on this null pointer caused a read access violation.

New Behavior

The game doesn't crash when crafting fireworks

Fix Implementation

  • Removed the TLS architecture and reverted resultItem to a private class member
  • Reverted resultItem to be a private member of the FireworksRecipe class.

AI Use Disclosure

No (I used AI to help debug the crash logs and refine the technical explanation, but the code logic was manually refactored).

Related Issues

@Alezito2008
Copy link
Contributor Author

image

@codeHusky
Copy link
Collaborator

I was not aware that 3x3 crafting was available in this version actually, interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Crafting Firework Star causes CTD

2 participants