Răsfoiți Sursa

libobs: Init source info before calling 'create'

When a source's private data is being created by a module, it wasn't
able to call most source functions because most functions rely on the
obs_source_info part of the context to be set.  This fixes that issue.

It was strange that this wasn't already the case because the other
context types already did the same thing.
jp9000 11 ani în urmă
părinte
comite
75d25b4e5b
1 a modificat fișierele cu 2 adăugiri și 3 ștergeri
  1. 2 3
      libobs/obs-source.c

+ 2 - 3
libobs/obs-source.c

@@ -111,8 +111,6 @@ bool obs_source_init(struct obs_source *source,
 	pthread_mutex_init_value(&source->video_mutex);
 	pthread_mutex_init_value(&source->audio_mutex);
 
-	memcpy(&source->info, info, sizeof(struct obs_source_info));
-
 	if (pthread_mutex_init(&source->filter_mutex, NULL) != 0)
 		return false;
 	if (pthread_mutex_init(&source->audio_mutex, NULL) != 0)
@@ -162,7 +160,8 @@ obs_source_t obs_source_create(enum obs_source_type type, const char *id,
 		return NULL;
 	}
 
-	source = bzalloc(sizeof(struct obs_source));
+	source       = bzalloc(sizeof(struct obs_source));
+	source->info = *info;
 
 	if (!obs_source_init_context(source, settings, name))
 		goto fail;