فهرست منبع

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.
jp9000 3 سال پیش
والد
کامیت
47d8f2e497
1فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 10 0
      libobs/obs-source.c

+ 10 - 0
libobs/obs-source.c

@@ -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);