From 6d5bb8b24479bd1b512dc217b064e960987f1a07 Mon Sep 17 00:00:00 2001 From: jpark37 Date: Fri, 6 Mar 2020 01:07:38 -0800 Subject: [PATCH] libobs: Only manipulate input source ref counts Filters can be hidden without being shown, which can unbalance the ref count and destroys them prematurely. We really only care about input sources having a chance to clean up from the render thread from the hide handler, Windows 10 window capture specifically. --- libobs/obs-source.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libobs/obs-source.c b/libobs/obs-source.c index 9547340c2..d0a8d6512 100644 --- a/libobs/obs-source.c +++ b/libobs/obs-source.c @@ -958,7 +958,8 @@ static void deactivate_source(obs_source_t *source) static void show_source(obs_source_t *source) { - obs_source_addref(source); + if (source->info.type == OBS_SOURCE_TYPE_INPUT) + obs_source_addref(source); if (source->context.data && source->info.show) source->info.show(source->context.data); @@ -971,7 +972,8 @@ static void hide_source(obs_source_t *source) source->info.hide(source->context.data); obs_source_dosignal(source, "source_hide", "hide"); - obs_source_release(source); + if (source->info.type == OBS_SOURCE_TYPE_INPUT) + obs_source_release(source); } static void activate_tree(obs_source_t *parent, obs_source_t *child,