Skip to content

utils: Start the scene counter at zero - #5

Merged
zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:fix/remove-last-scene
Oct 13, 2026
Merged

zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:fix/remove-last-scene

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

utils: Start the scene counter at zero

GetCanvasSceneCount() counted scenes into an uninitialized size_t, so it returned whatever the stack held plus the number of scenes. RemoveScene refuses to remove the last scene of the main canvas only when that count is below 2. With one scene left the check could pass; the last scene was removed, and the next GetCurrentProgramScene aborted OBS with std::logic_error (upstream obsproject/obs-studio#10532 and obsproject/obs-studio#10533).

The counter now starts at zero. Tested in obs-rust/obs-studio with test_ws_scene_count (5 of 5 fail before, 5 of 5 pass after, both libobs lanes), and end to end over obs-websocket: the last RemoveScene now returns 603 "You cannot remove the last scene in the collection." and OBS keeps running.

Fixes obs-rust/obs-studio#519. The obs-rust/obs-studio PR that moves the submodule to this commit, opened once this merges, carries the regression test.

🤖 Generated with Claude Code

GetCanvasSceneCount() counted into an uninitialized size_t, so the
result was whatever the stack held plus the number of scenes.
RemoveScene uses it to refuse removing the last scene of the main
canvas; with a garbage count that check passed, the last scene was
removed, and the next GetCurrentProgramScene aborted OBS with
std::logic_error (upstream obsproject/obs-studio#10532 and
obsproject/obs-studio#10533).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: obs-websocket: RemoveScene removes the last scene and the next GetCurrentProgramScene aborts OBS (upstream obsproject/obs-studio#10532, #10533)

2 participants