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.
This commit is contained in:
jp9000
2015-03-06 09:09:57 -08:00
parent b1ba8561ff
commit 502f4005f1
+3 -2
View File
@@ -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);