Skip to content

obs-websocket: Report a missing program or preview scene as null - #1256

Merged
zackees merged 2 commits into
obs-rust:masterfrom
rdoupe:fix/ws-program-scene-null
Oct 17, 2026
Merged

zackees merged 2 commits into
obs-rust:masterfrom
rdoupe:fix/ws-program-scene-null

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1254

What and why

GetCurrentProgramScene no longer aborts OBS when there is no program scene. It answers with null names and UUIDs instead, as GetSceneList already does (upstream obsproject/obs-websocket#1349, reported by stevets).

Reproduced in release v0.1.0-beta.20261014 (AppImage) and on master bbf55a0. Headless: private Xvfb, fresh HOME, dbus-run-session, --multi. One websocket client sends SetStudioModeEnabled true, CreateScene "victim", SetCurrentProgramScene "victim", RemoveScene "victim", waits 1 s, then sends GetSceneList, GetCurrentProgramScene, and SetCurrentProgramScene "Scene" + GetCurrentProgramScene.

v0.1.0-beta.20261014 master bbf55a0 This branch, C libobs lane This branch, Rust libobs lane
GetSceneList program after the removal null null null null
GetCurrentProgramScene SIGABRT: terminate called after throwing an instance of 'std::logic_error' / basic_string: construction from null is not valid SIGABRT, same message Success, all four fields null Success, all four fields null
Then SetCurrentProgramScene "Scene" + GetCurrentProgramScene (OBS gone) (OBS gone) "Scene" "Scene"

Removing the preview scene instead is fine everywhere: the frontend moves the preview to another scene.

RED → GREEN

  • RED commit: 031a72c test/cmocka: Add failing test for GetCurrentProgramScene without a program scene. test_ws_current_scene_removed builds the plugin's scene requests (RequestHandler_Scenes.cpp with Request.cpp and the Utils helpers it calls) against libobs, the way test_ws_transform_bounds does. The frontend calls answer from weak references to a real scene, as OBSStudioAPI does in Studio Mode. The guards program_scene_reported and preview_scene_reported pass. removed_program_scene_reported_null and removed_preview_scene_reported_null fail with GetCurrentProgramScene threw 'basic_string: construction from null is not valid' (the same for the preview). That is 2 of 4 failing, with ENABLE_RUST_LIBOBS OFF and ON. Linux only, like the other websocket request tests. The cases skip without a display (checked with DISPLAY unset).
  • GREEN: 0128dd5 moves plugins/obs-websocket from d79d2c2 to 0d663ee, the merged fork fix (requesthandler: Report a missing program or preview scene as null obs-websocket#17; same tree as the commit tested here). 4 of 4 pass in both lanes. Full OBS build (frontend + obs-websocket) in both lanes. Full ctest -j4 (private Xvfb, dbus-run-session, fresh HOME, system libobs-opengl masked, TMPDIR unset): 282/282 in both lanes. Every PipeWire/PulseAudio test ran. Skipped only open_crashes_without_obs_core (both lanes) and, in the Rust lane, test_startup_shutdown_cycles: its one case skips when one of its 2000 obs_startup() calls fails under load, and it passed on a rerun alone. clang-format 22.1 and gersemi 0.25.0 clean.
  • Real app: the table above (the release, master, and this branch built in both lanes, run with the same websocket script).

Checklist

  • Base is master
  • I claimed the issue, or no one else has an open PR for it
  • Characterization test (if the unit had none), then RED, then GREEN commits
  • (Optional) Local gate passed and the pushed head is stamped; otherwise PR CI runs the full suite
  • Warning or flag changes (-W..., ratchets): none
  • Intentional differences from C listed in the parity test header and rust/README.md (ports): not a port

AI note: Claude Code (Claude Opus 5.5) wrote the code, the test, the commit messages and this text under the submitter's direction, and ran the tests above on the submitter's machines.

🤖 Generated with Claude Code

rdoupe and others added 2 commits October 17, 2026 11:02
…ogram scene

In Studio Mode the frontend keeps the program scene as a weak reference,
so once that scene is removed (RemoveScene, or the scene list),
obs_frontend_get_current_scene() returns NULL. GetSceneList already
reports this as a null currentProgramSceneName. GetCurrentProgramScene
puts the NULL name straight into a json string, which throws
std::logic_error ("basic_string: construction from null is not valid")
on the websocket thread, and OBS aborts. GetCurrentPreviewScene has the
same shape.

test_ws_current_scene_removed builds the plugin's scene requests against
libobs and answers the frontend calls from weak references to a real
scene, as OBSStudioAPI does in Studio Mode. With the scene in place both
requests report it (guards); after the scene is removed both requests
throw instead of answering with null names: 2 of 4 cases fail.

Refs obs-rust#1254.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moves the submodule to the fork fix "requesthandler: Report a missing
program or preview scene as null" (port of obsproject/obs-websocket#1353
by andrewsoncha, extended to the preview scene). GetCurrentProgramScene
after the program scene was removed in Studio Mode aborted OBS; it now
answers with null names and UUIDs, as GetSceneList does.
GetCurrentPreviewScene gets the same check. Nothing changes while the
scene exists.

test_ws_current_scene_removed passes 4 of 4.

Fixes obs-rust#1254.

Co-Authored-By: andrewsoncha <65234283+andrewsoncha@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rdoupe
rdoupe requested a review from zackees as a code owner October 17, 2026 15:03
@zackees
zackees added this pull request to the merge queue Oct 17, 2026
Merged via the queue into obs-rust:master with commit 2cb03a7 Oct 17, 2026
26 checks passed
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.

bug: obs-websocket: GetCurrentProgramScene aborts OBS after the program scene is removed in Studio Mode (upstream obs-websocket#1349)

2 participants