Merge pull request #207 from versusvoid/fix-double-free

Fix double free
This commit is contained in:
Drew DeVault 2017-10-05 13:04:34 -04:00 committed by GitHub
commit 77eae178c7
1 changed files with 8 additions and 0 deletions

View File

@ -262,6 +262,8 @@ static void pointer_surface_destroy_notify(struct wl_listener *listener,
void *data) { void *data) {
struct wlr_seat_pointer_state *state = wl_container_of( struct wlr_seat_pointer_state *state = wl_container_of(
listener, state, surface_destroy); listener, state, surface_destroy);
wl_list_remove(&state->surface_destroy.link);
wl_list_init(&state->surface_destroy.link);
state->focused_surface = NULL; state->focused_surface = NULL;
wlr_seat_pointer_clear_focus(state->wlr_seat); wlr_seat_pointer_clear_focus(state->wlr_seat);
} }
@ -270,6 +272,8 @@ static void pointer_resource_destroy_notify(struct wl_listener *listener,
void *data) { void *data) {
struct wlr_seat_pointer_state *state = wl_container_of( struct wlr_seat_pointer_state *state = wl_container_of(
listener, state, resource_destroy); listener, state, resource_destroy);
wl_list_remove(&state->resource_destroy.link);
wl_list_init(&state->resource_destroy.link);
state->focused_surface = NULL; state->focused_surface = NULL;
wlr_seat_pointer_clear_focus(state->wlr_seat); wlr_seat_pointer_clear_focus(state->wlr_seat);
} }
@ -499,6 +503,8 @@ static void keyboard_surface_destroy_notify(struct wl_listener *listener,
void *data) { void *data) {
struct wlr_seat_keyboard_state *state = wl_container_of( struct wlr_seat_keyboard_state *state = wl_container_of(
listener, state, surface_destroy); listener, state, surface_destroy);
wl_list_remove(&state->surface_destroy.link);
wl_list_init(&state->surface_destroy.link);
state->focused_surface = NULL; state->focused_surface = NULL;
wlr_seat_keyboard_clear_focus(state->wlr_seat); wlr_seat_keyboard_clear_focus(state->wlr_seat);
} }
@ -507,6 +513,8 @@ static void keyboard_resource_destroy_notify(struct wl_listener *listener,
void *data) { void *data) {
struct wlr_seat_keyboard_state *state = wl_container_of( struct wlr_seat_keyboard_state *state = wl_container_of(
listener, state, resource_destroy); listener, state, resource_destroy);
wl_list_remove(&state->resource_destroy.link);
wl_list_init(&state->resource_destroy.link);
state->focused_surface = NULL; state->focused_surface = NULL;
wlr_seat_keyboard_clear_focus(state->wlr_seat); wlr_seat_keyboard_clear_focus(state->wlr_seat);
} }