Repository navigation
Description
Upstream OBS bug, reported by timmaclean in obsproject/obs-studio#10532 (OBS 30.1.2: removing every scene over obs-websocket, then GetCurrentProgramScene, crashes OBS) and obsproject/obs-studio#10533 (same, with CreateScene of the removed scene's name). Glitched reported the same on macOS in obsproject/obs-studio#10533. tt2468 suggested on obsproject/obs-studio#10532 that the "at least one scene" check was failing. Both issues are still open upstream, and the bug is in this fork too.
Location
plugins/obs-websocket/src/utils/Obs_NumberHelper.cppGetCanvasSceneCount()(line 44) counts scenes intosize_t ret;, which is never initialized. The result is whatever the stack held plus the number of scenes.plugins/obs-websocket/src/requesthandler/RequestHandler_Scenes.cppRemoveScene(line 307) refuses to remove the last scene of the main canvas only when that count is below 2. With a garbage count the check passes, and the last scene is removed.- With no scene left,
GetCurrentProgramScene(line 131) puts the name of a null scene into the response. That throwsstd::logic_errorand aborts OBS.
Class
Crash (SIGABRT) from an unchecked request. The check meant to prevent it reads an uninitialized variable.
How it is reached
Any obs-websocket client that removes scenes: GetSceneList, then RemoveScene for each scene, then GetCurrentProgramScene (obsproject/obs-studio#10532). Or with a new scene made current first, then the same, then CreateScene (obsproject/obs-studio#10533). Stream Deck plugins, bots and scripts that rebuild a scene collection all do this.
Reproduced in the current release
AppImage 33.0.0-beta6-799 (Rust libobs), driven headless over obs-websocket (private Xvfb, private config, password set):
| Steps | Result |
|---|---|
obsproject/obs-studio#10532: one scene "Scene"; RemoveScene "Scene" |
succeeds ({}), log "User Removed scene 'Scene'"; GetSceneList returns no scenes |
then GetCurrentProgramScene |
OBS aborts: terminate called after throwing an instance of 'std::logic_error' (3 of 3 runs) |
obsproject/obs-studio#10533: CreateScene TestScene, make it current, remove both scenes |
both removals succeed, no scenes left |
then CreateScene TestScene, GetCurrentProgramScene |
CreateScene succeeds, then OBS aborts the same way |
The expected result is that removing the last scene fails with "You cannot remove the last scene in the collection." (status 603, NotEnoughResources), as the request handler intends.
Proposed fix and failing test
Fix (in the obs-rust/obs-websocket fork, then a submodule update here, as for #99): start the counter at zero (size_t ret = 0;).
RED test (cmocka, test_ws_scene_count). It builds the plugin's own Obs_NumberHelper.cpp against stubbed libobs calls with a fake main canvas (no libobs startup, no display). It is compiled with -ftrivial-auto-var-init=pattern where the compiler supports it, so the uninitialized counter fails on every run:
- no scenes: 0;
- one scene: 1 (the case
RemoveScenemust refuse); - two scenes: 2;
- groups are not counted;
GetCanvasSceneCount()on the main canvas: 3 with three scenes and a group.
All 5 fail today in both libobs lanes, the same way every run.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 13, 2026
Claiming: this issue.
test_ws_scene_count(5 cases) builds obs-websocket's scene counter against a fake canvas: with one scene it does not answer 1, because the counter starts uninitialized, soRemoveSceneremoves the last scene. 5 of 5 fail today.PR today.
zackees commentedon Oct 13, 2026
Claiming.
zackees commentedon Oct 13, 2026
Releasing my claim: @rdoupe claimed this first (fork PR obs-rust/obs-websocket#5 is open with the fix, and the comment above says test_ws_scene_count is ready). Leaving the claimed label for that work. Do not open a parallel PR.
rdoupe commentedon Oct 14, 2026
@timmaclean you reported this in obsproject/obs-studio#10532 and #10533 (removing every scene over obs-websocket, then
GetCurrentProgramSceneorCreateScene, crashes OBS), so a heads-up: it's fixed here in obs-rust (obs-rust/obs-websocket#5, moved into OBS with the obs-websocket update in this release).Cause: the scene counter behind
RemoveScene's "at least one scene" check started uninitialized, so with one scene left it did not answer 1 andRemoveSceneremoved the last scene. The counter now starts at zero, so removing the last scene is refused.It's in obs-rust v0.1.0-beta.20261014: https://github.com/obs-rust/obs-studio/releases (Windows, macOS and Linux builds; on Arch it's
obs-studio-rust-gitin the AUR). obs-rust is an AI-assisted fork of OBS.If you get a chance to try it, a reply here on whether
RemoveScenenow refuses the last scene for you would really help.obs-websocket: Include the screenshot MIME declaration