Don't bother destroying resources after sending an error

An error makes the client exit, which cleans up the resources anyway.

Note (Jason Ekstrand):
This is safe for two reasons.  First, we should be handling object
destruction nicely anyway.  Second, in each of these cases, the resources
don't have any implementation or destruction set so it has absolutely no
effect on the rest of weston whether we destroy it now or later.
dev
Jasper St. Pierre 10 years ago committed by Jason Ekstrand
parent 0013a29d5e
commit c91408f3fb
  1. 1
      desktop-shell/input-panel.c
  2. 2
      desktop-shell/shell.c
  3. 1
      src/screenshooter.c
  4. 2
      src/text-backend.c

@ -356,7 +356,6 @@ bind_input_panel(struct wl_client *client,
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"interface object already bound"); "interface object already bound");
wl_resource_destroy(resource);
} }
void void

@ -5347,7 +5347,6 @@ bind_desktop_shell(struct wl_client *client,
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"permission to bind desktop_shell denied"); "permission to bind desktop_shell denied");
wl_resource_destroy(resource);
} }
static void static void
@ -5431,7 +5430,6 @@ bind_screensaver(struct wl_client *client,
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"interface object already bound"); "interface object already bound");
wl_resource_destroy(resource);
} }
struct switcher { struct switcher {

@ -265,7 +265,6 @@ bind_shooter(struct wl_client *client,
if (client != shooter->client) { if (client != shooter->client) {
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"screenshooter failed: permission denied"); "screenshooter failed: permission denied");
wl_resource_destroy(resource);
} }
wl_resource_set_implementation(resource, &screenshooter_implementation, wl_resource_set_implementation(resource, &screenshooter_implementation,

@ -790,14 +790,12 @@ bind_input_method(struct wl_client *client,
if (input_method->input_method_binding != NULL) { if (input_method->input_method_binding != NULL) {
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"interface object already bound"); "interface object already bound");
wl_resource_destroy(resource);
return; return;
} }
if (text_backend->input_method.client != client) { if (text_backend->input_method.client != client) {
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"permission to bind input_method denied"); "permission to bind input_method denied");
wl_resource_destroy(resource);
return; return;
} }

Loading…
Cancel
Save