modules: don't add CLIENT_ID when lingering

Because the object is not destroyed when the client is destroyed
and so the client.id might become invalid.
This commit is contained in:
Wim Taymans 2021-04-23 11:19:25 +02:00
parent d560628e2a
commit 962d3b9127
2 changed files with 9 additions and 11 deletions

View file

@ -165,9 +165,11 @@ static void *create_object(void *_data,
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d",
pw_impl_factory_get_info(d->this)->id);
client = resource ? pw_resource_get_client(resource): NULL;
str = pw_properties_get(properties, PW_KEY_OBJECT_LINGER);
linger = str ? pw_properties_parse_bool(str) : false;
if (client) {
client = resource ? pw_resource_get_client(resource): NULL;
if (client && !linger) {
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
pw_impl_client_get_info(client)->id);
}
@ -180,9 +182,6 @@ static void *create_object(void *_data,
pw_properties_setf(properties, "audio.adapt.follower", "pointer:%p", follower);
}
str = pw_properties_get(properties, PW_KEY_OBJECT_LINGER);
linger = str ? pw_properties_parse_bool(str) : false;
if (follower == NULL) {
factory_name = pw_properties_get(properties, SPA_KEY_FACTORY_NAME);
if (factory_name == NULL)

View file

@ -117,18 +117,17 @@ static void *create_object(void *_data,
if (factory_name == NULL)
goto error_properties;
client = resource ? pw_resource_get_client(resource) : NULL;
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d",
pw_global_get_id(pw_impl_factory_get_global(data->this)));
if (client) {
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
pw_global_get_id(pw_impl_client_get_global(client)));
}
str = pw_properties_get(properties, PW_KEY_OBJECT_LINGER);
linger = str ? pw_properties_parse_bool(str) : false;
client = resource ? pw_resource_get_client(resource) : NULL;
if (client && !linger) {
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
pw_global_get_id(pw_impl_client_get_global(client)));
}
node = pw_spa_node_load(context,
factory_name,
PW_SPA_NODE_FLAG_ACTIVATE,