Skip to content

Harden trade item application after sender crash - #9

Merged
absol89 merged 1 commit into
codex/player-trading-1.6.1170from
claude/crafted-potion-trade-r45fjg
Oct 7, 2026
Merged

absol89 merged 1 commit into
codex/player-trading-1.6.1170from
claude/crafted-potion-trade-r45fjg

Conversation

@absol89

@absol89 absol89 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Requested by Eric · project thread

Before: in the playtest, when the countdown finished, the sending player crashed while their game was adding the traded items to the partner's remote character. CrashLogger reported an access violation inside a dynamic cast on a pointer that was not a valid object, and the items were lost.

After: applying a trade no longer frees, invents or hands the engine forms and extra data it doesn't own. These are the paths that could leave the engine pointing at freed or foreign data at that moment.

Without symbols for the Skyrim Together module, the crash log can't name the exact function. This change removes the plausible causes rather than fixing one confirmed line.

How:

  • AddOrRemoveItem no longer releases the created-potion reference after adding the item, and the trade service no longer releases its prepared potions. If the inventory doesn't take its own reference, releasing ours could free a form it still points at.
  • Partner potion names come from a matching local potion, or from "Potion/Poison of ". Potions are no longer created and released on every UI refresh.
  • If no stored extra data list matches during a removal, RemoveItem now gets no extra data at all instead of a rebuilt list the inventory doesn't own.
  • EnchantmentItem::Create returns null when an effect setting is missing. GetExtraDataFromItem then skips attaching the enchantment instead of attaching a null one.

Verification: these are client-only changes, so only the Windows CI build covers them. The crash still needs reproducing in-game, preferably with a symbolized crash log.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SSW5HGXzi9kAVm4zdsSaid


Generated by Claude Code

A sender crashed in a dynamic cast while its game applied the traded
items to the partner's remote character. Remove the paths that could
leave the engine pointing at freed or foreign data there:

- Keep created-potion references instead of releasing them after the
  item is added; the inventory may not hold its own reference.
- Stop creating potion forms just to name partner offers in the UI.
- Never pass RemoveItem an extra data list the inventory does not own;
  fall back to removing without extra data.
- Refuse to create an enchantment whose effect setting is missing, and
  skip attaching a missing enchantment instead of attaching null.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSW5HGXzi9kAVm4zdsSaid
@absol89 absol89 self-assigned this Oct 7, 2026
@absol89
absol89 marked this pull request as ready for review October 7, 2026 08:44
@absol89
absol89 merged commit fdaa233 into codex/player-trading-1.6.1170 Oct 7, 2026
3 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