libobs: Remove all callbacks on source destroy

Removes all callbacks in use on sources right when a source is about to
be destroyed.

Fixes a crash where callbacks would still be executed while in a
destroyed state (particularly sidechain filters). Could also just mark
the source as being in a destroyed state and not accept anymore
obs_source_output_[audio/video] calls.
This commit is contained in:
jp9000 2022-01-04 01:09:57 -08:00
parent 02409c46fa
commit 47d8f2e497

View File

@ -614,6 +614,16 @@ void obs_source_destroy(struct obs_source *source)
if (!obs_source_valid(source, "obs_source_destroy"))
return;
if (is_audio_source(source)) {
pthread_mutex_lock(&source->audio_cb_mutex);
da_free(source->audio_cb_list);
pthread_mutex_unlock(&source->audio_cb_mutex);
}
pthread_mutex_lock(&source->caption_cb_mutex);
da_free(source->caption_cb_list);
pthread_mutex_unlock(&source->caption_cb_mutex);
if (source->info.type == OBS_SOURCE_TYPE_TRANSITION)
obs_transition_clear(source);