mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: handle NULL proxy
The proxy could be removed before we get the global remove so we need to handle the case where we access an object without a proxy and avoid a crash.
This commit is contained in:
parent
b759f9a691
commit
5d88e072a8
2 changed files with 16 additions and 0 deletions
|
|
@ -713,6 +713,8 @@ int pw_manager_set_metadata(struct pw_manager *manager,
|
|||
return -ENOTSUP;
|
||||
if (!SPA_FLAG_IS_SET(metadata->permissions, PW_PERM_W|PW_PERM_X))
|
||||
return -EACCES;
|
||||
if (metadata->proxy == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
if (type != NULL) {
|
||||
va_start(args, format);
|
||||
|
|
|
|||
|
|
@ -3045,6 +3045,8 @@ static int set_node_volume_mute(struct pw_manager_object *o,
|
|||
|
||||
if (!SPA_FLAG_IS_SET(o->permissions, PW_PERM_W | PW_PERM_X))
|
||||
return -EACCES;
|
||||
if (o->proxy == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
spa_pod_builder_push_object(&b, &f[0],
|
||||
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props);
|
||||
|
|
@ -3075,6 +3077,9 @@ static int set_card_volume_mute_delay(struct pw_manager_object *o, uint32_t id,
|
|||
if (!SPA_FLAG_IS_SET(o->permissions, PW_PERM_W | PW_PERM_X))
|
||||
return -EACCES;
|
||||
|
||||
if (o->proxy == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
spa_pod_builder_push_object(&b, &f[0],
|
||||
SPA_TYPE_OBJECT_ParamRoute, SPA_PARAM_Route);
|
||||
spa_pod_builder_add(&b,
|
||||
|
|
@ -3115,6 +3120,9 @@ static int set_card_port(struct pw_manager_object *o, uint32_t device_id,
|
|||
if (!SPA_FLAG_IS_SET(o->permissions, PW_PERM_W | PW_PERM_X))
|
||||
return -EACCES;
|
||||
|
||||
if (o->proxy == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
pw_device_set_param((struct pw_device*)o->proxy,
|
||||
SPA_PARAM_Route, 0,
|
||||
spa_pod_builder_add_object(&b,
|
||||
|
|
@ -4905,6 +4913,9 @@ static int do_set_profile(struct client *client, uint32_t command, uint32_t tag,
|
|||
if (!SPA_FLAG_IS_SET(o->permissions, PW_PERM_W | PW_PERM_X))
|
||||
return -EACCES;
|
||||
|
||||
if (o->proxy == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
pw_device_set_param((struct pw_device*)o->proxy,
|
||||
SPA_PARAM_Profile, 0,
|
||||
spa_pod_builder_add_object(&b,
|
||||
|
|
@ -4977,6 +4988,9 @@ static int do_suspend(struct client *client, uint32_t command, uint32_t tag, str
|
|||
if ((o = find_device(client, id, name, sink)) == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
if (o->proxy == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
if (suspend) {
|
||||
cmd = SPA_NODE_COMMAND_Suspend;
|
||||
pw_node_send_command((struct pw_node*)o->proxy, &SPA_NODE_COMMAND_INIT(cmd));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue