From ab520cab25ac58a7ce5008a758bf6b86501e12bc Mon Sep 17 00:00:00 2001 From: jp9000 Date: Mon, 2 Mar 2015 00:32:06 -0800 Subject: [PATCH] libobs: Hide sources when an obs_view is destroyed This fixes a bug where sources would not decrement their showing references when an obs_view is destroyed. --- libobs/obs-view.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libobs/obs-view.c b/libobs/obs-view.c index 3810d2d9e..a58059521 100644 --- a/libobs/obs-view.c +++ b/libobs/obs-view.c @@ -48,8 +48,13 @@ void obs_view_free(struct obs_view *view) { if (!view) return; - for (size_t i = 0; i < MAX_CHANNELS; i++) - obs_source_release(view->channels[i]); + for (size_t i = 0; i < MAX_CHANNELS; i++) { + struct obs_source *source = view->channels[i]; + if (source) { + obs_source_deactivate(source, AUX_VIEW); + obs_source_release(source); + } + } memset(view->channels, 0, sizeof(view->channels)); pthread_mutex_destroy(&view->channels_mutex);