Sfoglia il codice sorgente

libobs: Fix race condition when adding a filter

The source would sometimes be rendered before the code to add it to the
filter chain was executed, therefore it would cause a crash.
jp9000 10 anni fa
parent
commit
502f4005f1
1 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  1. 3 2
      libobs/obs-source.c

+ 3 - 2
libobs/obs-source.c

@@ -1269,12 +1269,13 @@ void obs_source_filter_add(obs_source_t *source, obs_source_t *filter)
 		(*back)->filter_target = filter;
 	}
 
+	filter->filter_parent = source;
+	filter->filter_target = source;
+
 	da_push_back(source->filters, &filter);
 
 	pthread_mutex_unlock(&source->filter_mutex);
 
-	filter->filter_parent = source;
-	filter->filter_target = source;
 	calldata_set_ptr(&cd, "source", source);
 	calldata_set_ptr(&cd, "filter", filter);