weston-info: destroy wl_keyboard
Fixes a memory leak by calling wl_keyboard_destroy on any keyboard that was used to listen for events. Signed-off-by: Markus Ongyerth <wl@ongy.net> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Pekka Paalanen
parent
ccdc81d609
commit
995bf51b2c
@@ -118,6 +118,7 @@ struct seat_info {
|
|||||||
struct wl_seat *seat;
|
struct wl_seat *seat;
|
||||||
struct weston_info *info;
|
struct weston_info *info;
|
||||||
|
|
||||||
|
struct wl_keyboard *keyboard;
|
||||||
uint32_t capabilities;
|
uint32_t capabilities;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
@@ -498,10 +499,8 @@ seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (caps & WL_SEAT_CAPABILITY_KEYBOARD) {
|
if (caps & WL_SEAT_CAPABILITY_KEYBOARD) {
|
||||||
struct wl_keyboard *keyboard;
|
seat->keyboard = wl_seat_get_keyboard(seat->seat);
|
||||||
|
wl_keyboard_add_listener(seat->keyboard, &keyboard_listener,
|
||||||
keyboard = wl_seat_get_keyboard(seat->seat);
|
|
||||||
wl_keyboard_add_listener(keyboard, &keyboard_listener,
|
|
||||||
seat);
|
seat);
|
||||||
|
|
||||||
seat->info->roundtrip_needed = true;
|
seat->info->roundtrip_needed = true;
|
||||||
@@ -531,6 +530,9 @@ destroy_seat_info(void *data)
|
|||||||
if (seat->name != NULL)
|
if (seat->name != NULL)
|
||||||
free(seat->name);
|
free(seat->name);
|
||||||
|
|
||||||
|
if (seat->keyboard)
|
||||||
|
wl_keyboard_destroy(seat->keyboard);
|
||||||
|
|
||||||
wl_list_remove(&seat->global_link);
|
wl_list_remove(&seat->global_link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user