Skip to content

make brief_stage non-copyable and non-movable; provide swap() and reset()#7557

Open
Goober5000 wants to merge 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/brief_stage_move
Open

make brief_stage non-copyable and non-movable; provide swap() and reset()#7557
Goober5000 wants to merge 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/brief_stage_move

Conversation

@Goober5000

Copy link
Copy Markdown
Contributor

brief_stage owns its icons and lines buffers through raw pointers, so the implicitly generated copy/move operations silently alias those buffers across two stages. Delete them and provide a custom swap() that exchanges members (keeping each slot with a distinct buffer), plus a reset() that restores the default-constructed state.

Update brief_compact_stages, the only code that assigned brief_stage objects: shift stages down by swapping (equivalent, since the removed stage buffers were already freed and the tail is cleared afterward) and clear the tail entries with reset().

…et()

brief_stage owns its icons and lines buffers through raw pointers, so the
implicitly generated copy/move operations silently alias those buffers
across two stages.  Delete them and provide a custom swap() that
exchanges members (keeping each slot with a distinct buffer), plus a
reset() that restores the default-constructed state.

Update brief_compact_stages, the only code that assigned brief_stage
objects: shift stages down by swapping (equivalent, since the removed
stage buffers were already freed and the tail is cleared afterward) and
clear the tail entries with reset().

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Goober5000 Goober5000 added cleanup A modification or rewrite of code to make it more understandable or easier to maintain. fix A fix for bugs, not-a-bugs, and/or regressions. labels Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup A modification or rewrite of code to make it more understandable or easier to maintain. fix A fix for bugs, not-a-bugs, and/or regressions.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant