You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
obs_shutdown leaks the weak canvas refs of sources left alive #2038
ASan (master run 40053887433) reports leaks in test_context_names and test_shutdown_type_lifetime at obs-canvas.c.h:330 (obs_canvas_get_weak_canvas in obs_canvas_insert_source) and at obs-canvas.c.h:158 (the canvas's control block).
obs_free_data() releases the main canvas first and destroys the remaining sources afterwards. obs_canvas_remove_source() releases source->canvas only when obs_weak_canvas_get_canvas() still returns the canvas, and by then it doesn't. So every leftover source leaks its weak ref, and the canvas control block stays referenced.
Fix: release the weak ref whether or not the canvas is still alive. Test: a new cmocka test checks that bnum_allocs() returns to its startup value after shutting down with a source left alive.
Fixed by #2041 (merged). After shutdown with sources left alive, the canvas control block and the canvas's source-name table are now freed. What stays by design is one control block per leftover source. Local ./unittest with the fix: 412/412 pass, including test_shutdown_canvas_weak_ref.
Activity
zackees commentedon Oct 24, 2026
Claiming: RED cmocka test (bnum_allocs after shutdown), GREEN obs_canvas_remove_source fix. PR today.
fix(canvas): free the source name table of a canvas destroyed with so…
fix(canvas): release a source's weak canvas ref after the canvas is g…
zackees commentedon Oct 24, 2026
Fixed by #2041 (merged). After shutdown with sources left alive, the canvas control block and the canvas's source-name table are now freed. What stays by design is one control block per leftover source. Local ./unittest with the fix: 412/412 pass, including test_shutdown_canvas_weak_ref.
libobs: Move the canvas flag rules
obs-core: Port the canvas flag rules
libobs: Move the canvas flag rules
obs-core: Port the canvas flag rules
obs-core: Port the canvas flag rules (obs-rust#2546)