Просмотр исходного кода

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.
jpark37 5 лет назад
Родитель
Сommit
6d5bb8b244
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      libobs/obs-source.c

+ 4 - 2
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,