Skip to content

libobs: A filter's size query can follow a NULL target during filter restore or removal #2172

Closed

Description

@rdoupe

Bug

A filter can briefly have a parent but no target, and its size query then follows a NULL target.

  • obs_source_restore_filters() sets each filter's parent one loop iteration before its target, outside filter_mutex.
  • obs_source_filter_remove_refless() clears the parent and then the target after it drops the lock.
  • obs_source_get_width()/obs_source_get_height() on a filter take no lock. For a filter that is disabled or has no size callback, get_base_width()/get_base_height() asks its target, and passes the NULL target to the next level.

So a size query racing with a filter restore (undo of a filter removal) or with a removal can crash. Callers include the Filters dialog's preview, scene item size updates and obs-websocket. Upstream has had the same code since 2021 (0fd1238).

Found by reading the code while porting the size routing (#2171); it has not been reproduced.

Plan

  1. RED: a real-libobs test that queries a filter's size while it has a parent but no target. Set up that state deterministically, e.g. from a filter callback during restore, or with a test hook if the window can't be reached otherwise. Explain the method in the test.
  2. GREEN:
    • get_base_width/get_base_height return 0 when the target is NULL;
    • obs_source_restore_filters() sets the target before the parent, so no filter is ever seen half-attached;
    • every attached filter reports the same size as before.

This waits for #2171, which moves the size routing these functions use.

Activity

  1. zackees commented on Oct 24, 2026

    @zackees
    Member

    Claiming: this issue. #2171 has merged; following the plan above.

  2. added
    claimed
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions