Skip to content

Commit

Permalink
libobs: Do not lock sources mutex unnecessarily
Browse files Browse the repository at this point in the history
In obs_load_sources(), the master sources mutex was being locked
seemingly unnecessarily. This could cause race conditions if used
incorrectly.
  • Loading branch information
Lain-B committed Feb 23, 2025
1 parent a8a349c commit 70dc224
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions libobs/obs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2254,7 +2254,6 @@ obs_source_t *obs_load_private_source(obs_data_t *source_data)

void obs_load_sources(obs_data_array_t *array, obs_load_source_cb cb, void *private_data)
{
struct obs_core_data *data = &obs->data;
DARRAY(obs_source_t *) sources;
size_t count;
size_t i;
Expand All @@ -2264,8 +2263,6 @@ void obs_load_sources(obs_data_array_t *array, obs_load_source_cb cb, void *priv
count = obs_data_array_count(array);
da_reserve(sources, count);

pthread_mutex_lock(&data->sources_mutex);

for (i = 0; i < count; i++) {
obs_data_t *source_data = obs_data_array_item(array, i);
obs_source_t *source = obs_load_source(source_data);
Expand All @@ -2292,8 +2289,6 @@ void obs_load_sources(obs_data_array_t *array, obs_load_source_cb cb, void *priv
for (i = 0; i < sources.num; i++)
obs_source_release(sources.array[i]);

pthread_mutex_unlock(&data->sources_mutex);

da_free(sources);
}

Expand Down

0 comments on commit 70dc224

Please sign in to comment.