From 502f4005f1bc568a03a2ff932d96705fc654430c Mon Sep 17 00:00:00 2001 From: jp9000 Date: Wed, 25 Feb 2015 21:08:09 -0800 Subject: [PATCH] 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. --- libobs/obs-source.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libobs/obs-source.c b/libobs/obs-source.c index aa4641bef..be560f779 100644 --- a/libobs/obs-source.c +++ b/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);