[PATCH weston 2/4] Don't bother destroying resources after sending an error

2014-08-07 Thread Jasper St. Pierre
An error makes the client exit, which cleans up the resources anyway.
---
 desktop-shell/input-panel.c | 1 -
 desktop-shell/shell.c   | 2 --
 src/screenshooter.c | 1 -
 src/text-backend.c  | 2 --
 4 files changed, 6 deletions(-)

diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c
index 47bd73c..435cd5d 100644
--- a/desktop-shell/input-panel.c
+++ b/desktop-shell/input-panel.c
@@ -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
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 5a613f1..250cf88 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -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 {
diff --git a/src/screenshooter.c b/src/screenshooter.c
index 369e920..9ae0d29 100644
--- a/src/screenshooter.c
+++ b/src/screenshooter.c
@@ -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,
diff --git a/src/text-backend.c b/src/text-backend.c
index d6a6f3b..1d549d4 100644
--- a/src/text-backend.c
+++ b/src/text-backend.c
@@ -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;
}
 
-- 
2.0.4

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 2/4] Don't bother destroying resources after sending an error

2014-08-08 Thread Jason Ekstrand
I squished in a little note for/from myself as to why this is OK.  I pushed
this one and the other 3
--Jason


On Thu, Aug 7, 2014 at 1:43 PM, Jasper St. Pierre 
wrote:

> An error makes the client exit, which cleans up the resources anyway.
> ---
>  desktop-shell/input-panel.c | 1 -
>  desktop-shell/shell.c   | 2 --
>  src/screenshooter.c | 1 -
>  src/text-backend.c  | 2 --
>  4 files changed, 6 deletions(-)
>
> diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c
> index 47bd73c..435cd5d 100644
> --- a/desktop-shell/input-panel.c
> +++ b/desktop-shell/input-panel.c
> @@ -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
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index 5a613f1..250cf88 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -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 {
> diff --git a/src/screenshooter.c b/src/screenshooter.c
> index 369e920..9ae0d29 100644
> --- a/src/screenshooter.c
> +++ b/src/screenshooter.c
> @@ -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,
> diff --git a/src/text-backend.c b/src/text-backend.c
> index d6a6f3b..1d549d4 100644
> --- a/src/text-backend.c
> +++ b/src/text-backend.c
> @@ -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;
> }
>
> --
> 2.0.4
>
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel