Selaa lähdekoodia

libobs: Fix releasing filters on source destroy

I was iterating through the obs_source::filters array to remove filters,
but every time I removed a filter, it would remove itself from the
array, therefore it would end up skipping items in the array, therefore
leaving filters unreleased.  This just removes the first filter until
all filters have been removed.
jp9000 10 vuotta sitten
vanhempi
sitoutus
8e5a0970b1
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      libobs/obs-source.c

+ 2 - 2
libobs/obs-source.c

@@ -249,8 +249,8 @@ void obs_source_destroy(struct obs_source *source)
 	if (source->filter_parent)
 		obs_source_filter_remove(source->filter_parent, source);
 
-	for (i = 0; i < source->filters.num; i++)
-		obs_source_release(source->filters.array[i]);
+	while (source->filters.num)
+		obs_source_filter_remove(source, source->filters.array[0]);
 
 	for (i = 0; i < source->async_cache.num; i++)
 		obs_source_frame_destroy(source->async_cache.array[i].frame);