From 4bec3b56d4c2614efd3e2cd1b5de6605e18a74dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sun, 25 Jun 2023 19:47:04 +0200 Subject: [PATCH] pipewire: pw_proxy_init(): take pointer to core `pw_proxy::core` must be initialized for `pw_proxy_init()` to succeed, so take it as a parameter instead of relying on the caller to initialize that field beforehand. --- src/pipewire/core.c | 3 +-- src/pipewire/private.h | 2 +- src/pipewire/proxy.c | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pipewire/core.c b/src/pipewire/core.c index d332cd2f8..48931a017 100644 --- a/src/pipewire/core.c +++ b/src/pipewire/core.c @@ -317,7 +317,6 @@ static struct pw_core *core_new(struct pw_context *context, pw_properties_add(properties, &context->properties->dict); - p->proxy.core = p; p->context = context; p->properties = properties; p->pool = pw_mempool_new(NULL); @@ -343,7 +342,7 @@ static struct pw_core *core_new(struct pw_context *context, if (p->conn == NULL) goto error_connection; - if ((res = pw_proxy_init(&p->proxy, PW_TYPE_INTERFACE_Core, PW_VERSION_CORE)) < 0) + if ((res = pw_proxy_init(&p->proxy, p, PW_TYPE_INTERFACE_Core, PW_VERSION_CORE)) < 0) goto error_proxy; p->client = (struct pw_client*)pw_proxy_new(&p->proxy, diff --git a/src/pipewire/private.h b/src/pipewire/private.h index f8d8b51a0..87f79ea83 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -1230,7 +1230,7 @@ int pw_context_debug_port_params(struct pw_context *context, const struct pw_export_type *pw_context_find_export_type(struct pw_context *context, const char *type); -int pw_proxy_init(struct pw_proxy *proxy, const char *type, uint32_t version); +int pw_proxy_init(struct pw_proxy *proxy, struct pw_core *core, const char *type, uint32_t version); void pw_proxy_remove(struct pw_proxy *proxy); diff --git a/src/pipewire/proxy.c b/src/pipewire/proxy.c index 9da9766f9..e45b2dcb7 100644 --- a/src/pipewire/proxy.c +++ b/src/pipewire/proxy.c @@ -21,10 +21,11 @@ struct proxy { }; /** \endcond */ -int pw_proxy_init(struct pw_proxy *proxy, const char *type, uint32_t version) +int pw_proxy_init(struct pw_proxy *proxy, struct pw_core *core, const char *type, uint32_t version) { int res; + proxy->core = core; proxy->refcount = 1; proxy->type = type; proxy->version = version; @@ -81,9 +82,8 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory, return NULL; this = &impl->this; - this->core = factory->core; - if ((res = pw_proxy_init(this, type, version)) < 0) + if ((res = pw_proxy_init(this, factory->core, type, version)) < 0) goto error_init; if (user_data_size > 0)