aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2017-08-15 15:27:28 +0200
committerDominique Martinet <asmadeus@codewreck.org>2017-08-15 15:34:26 +0200
commitd49edc8243c9ccba7a4a5dc210f87e9fba03a444 (patch)
tree5fc6401ea1875d8c3839127296fc8810afe08519
parent5dae8e1be81e12299d78b4319fd63c1edd24c08a (diff)
wl_shell/compositor surface: do not check if it's in list before removing
-rw-r--r--examples/compositor/wl_compositor.c12
-rw-r--r--types/wlr_wl_shell.c10
2 files changed, 2 insertions, 20 deletions
diff --git a/examples/compositor/wl_compositor.c b/examples/compositor/wl_compositor.c
index 034a7ff0..0bab345d 100644
--- a/examples/compositor/wl_compositor.c
+++ b/examples/compositor/wl_compositor.c
@@ -7,17 +7,7 @@
#include "compositor.h"
static void destroy_surface_listener(struct wl_listener *listener, void *data) {
- struct wlr_surface *surface = wl_resource_get_user_data(data);
- struct wl_compositor_state *state = surface->compositor_data;
- assert(data == surface->resource);
-
- struct wl_resource *res = NULL;
- wl_list_for_each(res, &state->surfaces, link) {
- if (res == surface->resource) {
- wl_list_remove(wl_resource_get_link(res));
- break;
- }
- }
+ wl_list_remove(wl_resource_get_link(data));
}
static void wl_compositor_create_surface(struct wl_client *client,
diff --git a/types/wlr_wl_shell.c b/types/wlr_wl_shell.c
index d84775d9..154e54f9 100644
--- a/types/wlr_wl_shell.c
+++ b/types/wlr_wl_shell.c
@@ -98,15 +98,7 @@ static struct wl_shell_interface wl_shell_impl = {
};
static void wl_shell_destroy(struct wl_resource *resource) {
- struct wlr_wl_shell *wl_shell = wl_resource_get_user_data(resource);
- struct wl_resource *_resource = NULL;
- wl_resource_for_each(_resource, &wl_shell->wl_resources) {
- if (_resource == resource) {
- struct wl_list *link = wl_resource_get_link(_resource);
- wl_list_remove(link);
- break;
- }
- }
+ wl_list_remove(wl_resource_get_link(resource));
}
static void wl_shell_bind(struct wl_client *wl_client, void *_wl_shell,