Skip to content

Commit

Permalink
libobs: Mark filters as private (band-aid fix)
Browse files Browse the repository at this point in the history
This patch fixes a specific crash where if the user named a filter the
same name as an input source that already existed in the system, scene
item loading code could find the filter with the same name instead of
the source, and mistakenly use it as the scene item's source directly.
This would cause a crash when trying to render that filter as a regular
source.

Marking filters as private is a temporary and simple workaround to the
solution.  Filters are currently not meant to be found via the main
enumeration/search functions, which is a design flaw (lack of
consistency).  In future major API revisions of libobs, filters should
be reworked to act as sources, with the sources they filter as
sub-sources ideally.

Additionally, the concept of "private context objects" and "primary
lists of context objects" in the back-end should probably also be
removed, allowing the font-end (or optional separate API layers) to
control all primary lists of obs context objects.  These minor issues
that occur ultimately stem from API design flaws which need to be
corrected.
  • Loading branch information
jp9000 committed Apr 10, 2016
1 parent f23974a commit 2274b57
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libobs/obs-source.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,13 @@ static obs_source_t *obs_source_create_internal(const char *id,
source->owns_info_id = true;
} else {
source->info = *info;

/* Always mark filters as private so they aren't found by
* source enum/search functions.
*
* XXX: Fix design flaws with filters */
if (info->type == OBS_SOURCE_TYPE_FILTER)
private = true;
}

source->mute_unmute_key = OBS_INVALID_HOTKEY_PAIR_ID;
Expand Down

0 comments on commit 2274b57

Please sign in to comment.