wl_shell/compositor surface: do not check if it's in list before removing

This commit is contained in:
Dominique Martinet 2017-08-15 15:27:28 +02:00
parent 5dae8e1be8
commit d49edc8243
2 changed files with 2 additions and 20 deletions

View file

@ -7,17 +7,7 @@
#include "compositor.h" #include "compositor.h"
static void destroy_surface_listener(struct wl_listener *listener, void *data) { static void destroy_surface_listener(struct wl_listener *listener, void *data) {
struct wlr_surface *surface = wl_resource_get_user_data(data); wl_list_remove(wl_resource_get_link(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;
}
}
} }
static void wl_compositor_create_surface(struct wl_client *client, static void wl_compositor_create_surface(struct wl_client *client,

View file

@ -98,15 +98,7 @@ static struct wl_shell_interface wl_shell_impl = {
}; };
static void wl_shell_destroy(struct wl_resource *resource) { static void wl_shell_destroy(struct wl_resource *resource) {
struct wlr_wl_shell *wl_shell = wl_resource_get_user_data(resource); wl_list_remove(wl_resource_get_link(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;
}
}
} }
static void wl_shell_bind(struct wl_client *wl_client, void *_wl_shell, static void wl_shell_bind(struct wl_client *wl_client, void *_wl_shell,