Sfoglia il codice sorgente

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.
jp9000 11 anni fa
parent
commit
eed1a51d3a
1 ha cambiato i file con 12 aggiunte e 1 eliminazioni
  1. 12 1
      libobs/obs.c

+ 12 - 1
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");