Repository navigation
Keep interior camera markers alive between SetCameraPos calls - #216
Closed
IvanPerrella wants to merge 1 commit into
Closed
IvanPerrella wants to merge 1 commit into
IvanPerrella wants to merge 1 commit into
Conversation
active_camera holds a pointer into SetCameraPos's camera list across frames. 98580bd moved that list from the stack to a per-call heap allocation, so the pointer dangled after each call and walking between camera zones in an interior read freed memory and crashed in CFrame::GetLWMatrix. The PS2 code only worked because its stack array sat at the same address every frame; give the list static storage so the remembered entry is the one rebuilt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
I believe this is a duplication of #213 Thank you for the PR though! |
Adubbz
added a commit
that referenced
this pull request
Oct 24, 2026
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a crash (
0xC0000005, access violation) when walking between fixed-camera zones inside an interior.SetCameraPos(port/src/edit_in.cpp) builds the interior's camera markers into a local list every frame, and the file-staticactive_camerakeeps a pointer to one of those entries across frames (it lingers on the old marker forcamera_change_countframes after the player leaves its box). 98580bd moved that list from a stack array to a per-callstd::make_uniqueallocation, so from the next call onactive_camerapoints at freed heap memory. Walking from one camera zone to another then reads garbage inCFrame::GetLWMatrixand crashes.The PS2 code only worked because its
INTERIOR_CAMERA cameras[8]stack array sat at the same address every frame, so the stale pointer landed on the entry rebuilt for that frame. This change gives the list static storage, which keeps that behaviour without relying on stack layout.active_camerais still reset to null on interior init.Backtrace (windows-x64 Debug, PAL, house
i01h06)Test plan
build.bat windows-x64andbuild.bat windows-x64-releasebuild on Windows 11🤖 Generated with Claude Code