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 cell-change crash from SetActorInventory() calling s_unequipAll followed by s_removeAllItems #726

Merged
merged 5 commits into from
Oct 26, 2024

Conversation

rfortier
Copy link
Contributor

@rfortier rfortier commented Oct 24, 2024

This fixes a cell change crash provoked by bugs in Actor::SetActorInventory(), but really a bug in the downcall to EquipManager::UnequipAll() which invokes skyrim-native TUnequipAll.

SetActorInventory() effectively calls UnequipAll(), RemoveAllItems(), then sets the new inventory with AddRemoveItem(). But the RemoveAllItems() script also Unequips() each item, which seems to trigger a bug because the UnequipAll is still animating unequips.

First fix is comment out the unequipall.

Second fix is remove as many SetActorInventory() calls as possible. In particular, when you set the inventory on a local Actor, you don't also have to set it again when the change reflects back to you in OnRemoteSpawnDataReceived(). That's just a more elaborate way of provoking overlapping Unequips (basically, back-to-back RemoveAllItems())

Partially addresses #723 (0x140443C43 crash site)

…cter that the remote system is obviously not authoratative for.

From the code comment:
Only accept spawn position and inventory updates if not for local player
The remote system is simply not authoritative for this info, and trying
to take it from the remote can result in concurrent update corruption
That's the real problem, either s_pRemoveAllItems or s_unequipAll
have async behavior themselves or undocumented behavior that
causes concurrency issues.
@rfortier rfortier changed the title Fix cellchange crash1 Fix cell-change crash from SetActorInventory() calling s_unequipAll followed by s_removeAllItems Oct 24, 2024
…spawn data looping back to themselves."

This reverts commit ed79bf1.
…yerCharacter that the remote system is obviously not authoratative for."

This reverts commit 49bfc73.
@rfortier
Copy link
Contributor Author

Reverted the 2nd fix for now, as is riskier and may be supplanted by a more comprehensive fix.

@RobbeBryssinck RobbeBryssinck merged commit 41e4e55 into tiltedphoques:dev Oct 26, 2024
2 checks passed
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.

2 participants