Don't bother destroying resources after sending an error
authorJasper St. Pierre <jstpierre@mecheye.net>
Thu, 7 Aug 2014 20:43:12 +0000 (16:43 -0400)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 8 Aug 2014 21:57:17 +0000 (14:57 -0700)
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.

desktop-shell/input-panel.c
desktop-shell/shell.c
src/screenshooter.c
src/text-backend.c

index 47bd73c..435cd5d 100644 (file)
@@ -356,7 +356,6 @@ bind_input_panel(struct wl_client *client,
 
        wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
                               "interface object already bound");
-       wl_resource_destroy(resource);
 }
 
 void
index 5a613f1..250cf88 100644 (file)
@@ -5347,7 +5347,6 @@ bind_desktop_shell(struct wl_client *client,
 
        wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
                               "permission to bind desktop_shell denied");
-       wl_resource_destroy(resource);
 }
 
 static void
@@ -5431,7 +5430,6 @@ bind_screensaver(struct wl_client *client,
 
        wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
                               "interface object already bound");
-       wl_resource_destroy(resource);
 }
 
 struct switcher {
index 369e920..9ae0d29 100644 (file)
@@ -265,7 +265,6 @@ bind_shooter(struct wl_client *client,
        if (client != shooter->client) {
                wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
                                       "screenshooter failed: permission denied");
-               wl_resource_destroy(resource);
        }
 
        wl_resource_set_implementation(resource, &screenshooter_implementation,
index d6a6f3b..1d549d4 100644 (file)
@@ -790,14 +790,12 @@ bind_input_method(struct wl_client *client,
        if (input_method->input_method_binding != NULL) {
                wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
                                       "interface object already bound");
-               wl_resource_destroy(resource);
                return;
        }
 
        if (text_backend->input_method.client != client) {
                wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
                                       "permission to bind input_method denied");
-               wl_resource_destroy(resource);
                return;
        }