Make sure we bind before registering the global

Bind to the resource in create_object before we register the global.
This ensure a client gets to see the resource global id associated
with the resource before it appears in the registry, which makes it
easier to patch the local proxy to the global object.
This commit is contained in:
Wim Taymans 2019-11-25 16:31:30 +01:00
parent b7c5e00697
commit 8acae9db7d
3 changed files with 88 additions and 58 deletions

View file

@ -124,25 +124,19 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
data->impl = impl;
data->resource = resource;
pw_log_debug(".");
// pw_resource_install_marshal(resource, true);
/* listen for when the resource goes away */
pw_resource_add_listener(resource,
&data->resource_listener,
&resource_events, data);
/* resource methods -> implemention */
pw_log_debug(".");
pw_resource_add_object_listener(resource,
&data->object_listener,
&metadata_methods, data);
/* implementation events -> resource */
pw_log_debug(". %p", impl->metadata);
pw_metadata_add_listener(impl->metadata,
&data->metadata_listener,
&metadata_events, data);
pw_log_debug(".");
return 0;
}