Skip to content

fix(cosmetics): purge per-ghost caches on despawn [PATCH 1] - #3

Open
nullbrik wants to merge 1 commit into
CairnMP:developfrom
nullbrik:fix/ghost-cosmetic-cache-leak
Open

fix(cosmetics): purge per-ghost caches on despawn [PATCH 1]#3
nullbrik wants to merge 1 commit into
CairnMP:developfrom
nullbrik:fix/ghost-cosmetic-cache-leak

Conversation

@nullbrik

Copy link
Copy Markdown
Collaborator

CosmeticApi keys _ghostGloveRigs and _ghostStickRest by the ghost GameObject pointer, but nothing ever cleared them — unlike FingerApi, which already resets its own per-ghost bone cache. IL2CPP recycles pointers after a despawn, so a new ghost could inherit a departed player's glove rig, and both dictionaries grew for the whole session.

_ghostStickRest was the worse of the two: it has no null guard on the cached entry, so a stale rest pose made ApplyGhostStickByAnchorMode bail out every frame while ContainsKey kept the capture block from re-running — the new ghost's stick could never return to its stowed position.

Purge both dictionaries from the three places RemotePlayerManager already destroys ghosts, and clear them wholesale on scene reset, next to the existing FingerApi.ResetFingerSyncCache call.

CosmeticApi keys _ghostGloveRigs and _ghostStickRest by the ghost GameObject
pointer, but nothing ever cleared them — unlike FingerApi, which already resets
its own per-ghost bone cache. IL2CPP recycles pointers after a despawn, so a new
ghost could inherit a departed player's glove rig, and both dictionaries grew for
the whole session.

_ghostStickRest was the worse of the two: it has no null guard on the cached
entry, so a stale rest pose made ApplyGhostStickByAnchorMode bail out every frame
while ContainsKey kept the capture block from re-running — the new ghost's stick
could never return to its stowed position.

Purge both dictionaries from the three places RemotePlayerManager already
destroys ghosts, and clear them wholesale on scene reset, next to the existing
FingerApi.ResetFingerSyncCache call.
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.

1 participant