pulse: return NOENTITY when an item was not found

It's possible that the object was removed right after doing the call, in
that case we need to return NOENTITY because apps handle this
gracefully.
This commit is contained in:
Wim Taymans 2020-08-19 17:03:44 +02:00
parent cde6b99890
commit 120090741a

View file

@ -214,7 +214,7 @@ static void sink_info(pa_operation *o, void *userdata)
if (g) { if (g) {
error = sink_callback(c, g, d); error = sink_callback(c, g, d);
} else { } else {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
} }
if (error) if (error)
pa_context_set_error(c, error); pa_context_set_error(c, error);
@ -491,7 +491,7 @@ static void do_node_volume_mute(pa_operation *o, void *userdata)
d->have_volume ? g->node_info.mute : d->mute, d->have_volume ? g->node_info.mute : d->mute,
d->mask); d->mask);
} else { } else {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
} }
if (error != 0) if (error != 0)
pa_context_set_error(c, error); pa_context_set_error(c, error);
@ -724,7 +724,7 @@ static void do_device_route(pa_operation *o, void *userdata)
if (g) { if (g) {
error = set_device_route(c, g, d->port, d->direction); error = set_device_route(c, g, d->port, d->direction);
} else { } else {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
} }
if (error != 0) if (error != 0)
pa_context_set_error(c, error); pa_context_set_error(c, error);
@ -939,7 +939,7 @@ static void source_info(pa_operation *o, void *userdata)
if (g) { if (g) {
error = source_callback(c, g, d); error = source_callback(c, g, d);
} else { } else {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
} }
if (error) if (error)
pa_context_set_error(c, error); pa_context_set_error(c, error);
@ -1324,7 +1324,7 @@ static void module_info(pa_operation *o, void *userdata)
if (g) { if (g) {
error = module_callback(c, d, g); error = module_callback(c, d, g);
} else { } else {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
} }
if (error) if (error)
pa_context_set_error(c, error); pa_context_set_error(c, error);
@ -1468,7 +1468,7 @@ static void client_info(pa_operation *o, void *userdata)
if (g) { if (g) {
error = client_callback(c, d, g); error = client_callback(c, d, g);
} else { } else {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
} }
if (error) if (error)
pa_context_set_error(c, error); pa_context_set_error(c, error);
@ -1554,7 +1554,7 @@ static void do_kill_client(pa_operation *o, void *userdata)
if (g) { if (g) {
pw_registry_destroy(c->registry, g->id); pw_registry_destroy(c->registry, g->id);
} else { } else {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
} }
if (error != 0) if (error != 0)
pa_context_set_error(c, error); pa_context_set_error(c, error);
@ -1614,7 +1614,7 @@ static void card_info(pa_operation *o, void *userdata)
if (g) { if (g) {
error = card_callback(c, d, g); error = card_callback(c, d, g);
} else { } else {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
} }
if (error != 0) if (error != 0)
pa_context_set_error(c, error); pa_context_set_error(c, error);
@ -1725,7 +1725,7 @@ static void card_profile(pa_operation *o, void *userdata)
g = NULL; g = NULL;
if (g == NULL) { if (g == NULL) {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
goto done; goto done;
} }
@ -1746,7 +1746,7 @@ static void card_profile(pa_operation *o, void *userdata)
} }
} }
if (id == SPA_ID_INVALID) { if (id == SPA_ID_INVALID) {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
goto done; goto done;
} }
@ -1950,10 +1950,10 @@ static void sink_input_info(pa_operation *o, void *userdata)
if (g) { if (g) {
error = sink_input_callback(c, d, g); error = sink_input_callback(c, d, g);
} else { } else {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
} }
if (error) if (error)
pa_context_set_error(c, PA_ERR_INVALID); pa_context_set_error(c, error);
d->cb(c, NULL, error ? -1 : 1, d->userdata); d->cb(c, NULL, error ? -1 : 1, d->userdata);
pa_operation_done(o); pa_operation_done(o);
} }
@ -2145,7 +2145,7 @@ static void do_stream_volume_mute(pa_operation *o, void *userdata)
d->have_volume ? &d->volume : NULL, d->have_volume ? &d->volume : NULL,
d->have_volume ? g->node_info.mute : d->mute); d->have_volume ? g->node_info.mute : d->mute);
} else { } else {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
} }
if (error != 0) if (error != 0)
@ -2219,7 +2219,7 @@ static void do_kill_stream(pa_operation *o, void *userdata)
} else if (g) { } else if (g) {
pw_registry_destroy(c->registry, g->id); pw_registry_destroy(c->registry, g->id);
} else { } else {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
} }
if (error != 0) if (error != 0)
pa_context_set_error(c, error); pa_context_set_error(c, error);
@ -2351,7 +2351,7 @@ static void source_output_info(pa_operation *o, void *userdata)
if (g) { if (g) {
error = source_output_callback(d, c, g); error = source_output_callback(d, c, g);
} else { } else {
error = PA_ERR_INVALID; error = PA_ERR_NOENTITY;
} }
if (error) if (error)
pa_context_set_error(c, error); pa_context_set_error(c, error);