Skip to content

libobs: Make a source's removed flag atomic (#2105) - #2106

Merged
zackees merged 1 commit into
masterfrom
fix/source-removed-atomic
Oct 24, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/source-removed-atomic

Conversation

@zackees

@zackees zackees commented Oct 24, 2026

Copy link
Copy Markdown
Member

Fixes #2105

obs_source_remove sets source->removed on the UI thread while the render threads read it: obs_source_removed, obs_view_source_removed and obs_scene_add_internal. The field is now volatile bool in obs-internal.h (not a public header), and all five sites use os_atomic_load_bool/os_atomic_set_bool, as #2083 did for activate_refs and show_refs. The flag only ever goes false to true, so behavior is unchanged. Rust reads it only through obs_view_source_removed.

RED: TSan run 40074741825 on master has 28 reports of obs-source.c.h:976 against :963. Only TSan shows the race, so there's no Tier 2 RED. GREEN is the TSan run dispatched on this branch, and I'll post its counts. ./lint passes; Tier 2 in PR CI checks behavior is unchanged.

obs_source_remove sets source->removed on the UI thread while the render
threads read it (obs_source_removed, obs_view_source_removed, scene add).
Make it volatile and use os_atomic_load_bool/os_atomic_set_bool, as
#2083 did for activate_refs and show_refs.

Fixes #2105
@zackees
zackees enabled auto-merge October 24, 2026 09:05
@zackees
zackees added this pull request to the merge queue Oct 24, 2026
Merged via the queue into master with commit ebcd48a Oct 24, 2026
37 checks passed
@zackees

zackees commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

GREEN: TSan run 40080552267 on this branch has 0 reports touching source->removed (obs-source.c.h:963/976, obs-scene.c.h:2075, obs_view_source_removed), against 96 report lines in master run 40074741825.

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.

libobs: source->removed is a plain bool read by the render threads (data race)

1 participant