tiltedphoques / TiltedEvolution

Skyrim mod to play online!
https://wiki.tiltedphoques.com/tilted-online/
Other
1.07k stars 224 forks source link

Fix cell-change crash from SetActorInventory() calling s_unequipAll followed by s_removeAllItems #726

Closed rfortier closed 1 month ago

rfortier commented 1 month ago

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 https://github.com/tiltedphoques/TiltedEvolution/issues/723 (0x140443C43 crash site)

rfortier commented 1 month ago

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