Browse Source

libobs: Add extra reference when source is displayed

This provides a chance to clean up resources on the graphics thread in
the hide callback, which Windows Graphics Capture requires.
jpark37 6 years ago
parent
commit
9cff2ae6bb
1 changed files with 4 additions and 0 deletions
  1. 4 0
      libobs/obs-source.c

+ 4 - 0
libobs/obs-source.c

@@ -958,6 +958,8 @@ static void deactivate_source(obs_source_t *source)
 
 static void show_source(obs_source_t *source)
 {
+	obs_source_addref(source);
+
 	if (source->context.data && source->info.show)
 		source->info.show(source->context.data);
 	obs_source_dosignal(source, "source_show", "show");
@@ -968,6 +970,8 @@ static void hide_source(obs_source_t *source)
 	if (source->context.data && source->info.hide)
 		source->info.hide(source->context.data);
 	obs_source_dosignal(source, "source_hide", "hide");
+
+	obs_source_release(source);
 }
 
 static void activate_tree(obs_source_t *parent, obs_source_t *child,