From eed1a51d3a45d6c63b09cb073afcaee8ff8be3f6 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Mon, 2 Mar 2015 00:30:40 -0800 Subject: [PATCH] libobs: Free main view separately from std. views The main view does not need to worry about hiding/deactivation of sources when it's being freed here, when the obs context is shutting down in this section of obs, all the sources are being freed, thus there's no need to worry about deactivating/hiding sources. --- libobs/obs.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libobs/obs.c b/libobs/obs.c index 6d9fa5304..e245864c8 100644 --- a/libobs/obs.c +++ b/libobs/obs.c @@ -489,6 +489,17 @@ fail: return data->valid; } +void obs_main_view_free(struct obs_view *view) +{ + if (!view) return; + + for (size_t i = 0; i < MAX_CHANNELS; i++) + obs_source_release(view->channels[i]); + + memset(view->channels, 0, sizeof(view->channels)); + pthread_mutex_destroy(&view->channels_mutex); +} + #define FREE_OBS_LINKED_LIST(type) \ do { \ int unfreed = 0; \ @@ -507,7 +518,7 @@ static void obs_free_data(void) data->valid = false; - obs_view_free(&data->main_view); + obs_main_view_free(&data->main_view); blog(LOG_INFO, "Freeing OBS context data");