Skip to content
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

Fix a crash in item::use_amount #39566

Merged
merged 1 commit into from
Apr 14, 2020

Conversation

Qrox
Copy link
Contributor

@Qrox Qrox commented Apr 14, 2020

Summary

SUMMARY: Bugfixes "Fix a crash when some action consumes inventory items"

Purpose of change

Fixes #39507 and fixes #39509. Calling remove_item in the lambda function in item_use_amount caused memory corruption that caused the game to crash when the next contained item is visited.

Describe the solution

Populate a list of removed items and remove them after visiting all contained items.

Testing

Loaded @Damdern's save from #39507 and the save from #39509, and the crash no longer happened.

Additional context

May also fix #39522 since the crash log looks similar to @Damdern's crash log in #39507.

@mlangsdorf mlangsdorf added <Bugfix> This is a fix for a bug (or closes open issue) <Crash / Freeze> Fatal bug that results in hangs or crashes. Items / Item Actions / Item Qualities Items and how they work and interact labels Apr 14, 2020
@ZhilkinSerg ZhilkinSerg merged commit 66dad5a into CleverRaven:master Apr 14, 2020
@Qrox Qrox deleted the fix-use-amount-crash branch April 15, 2020 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) <Crash / Freeze> Fatal bug that results in hangs or crashes. Items / Item Actions / Item Qualities Items and how they work and interact
Projects
None yet
3 participants