From e1293a78530a5de9280ee76e83488a2a04c95c79 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 11 Aug 2017 22:55:36 +0200 Subject: libinput: signal input remove on libinput backend destroy This lets the upper crust cleanup and free their own states --- backend/libinput/backend.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'backend/libinput/backend.c') diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 19fe8fe7..58bd62f2 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -84,7 +84,9 @@ static void wlr_libinput_backend_destroy(struct wlr_backend_state *state) { for (size_t i = 0; i < state->devices->length; i++) { list_t *wlr_devices = state->devices->items[i]; for (size_t j = 0; j < wlr_devices->length; j++) { - wlr_input_device_destroy(wlr_devices->items[j]); + struct wlr_input_device *wlr_device = wlr_devices->items[j]; + wl_signal_emit(&state->backend->events.input_remove, wlr_device); + wlr_input_device_destroy(wlr_device); } list_free(wlr_devices); } -- cgit v1.2.3 From de86965174a5ccb6c204c52d6e57812c1fa64a24 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Sat, 12 Aug 2017 00:02:04 +0200 Subject: Use libinput_event_destroy/xkb_*_unref Also sneak in a missing drmModeFreePlaneResources --- backend/drm/drm.c | 1 + backend/libinput/backend.c | 1 + examples/shared.c | 2 ++ 3 files changed, 4 insertions(+) (limited to 'backend/libinput/backend.c') diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 8062a478..04822040 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -104,6 +104,7 @@ static bool init_planes(struct wlr_backend_state *drm) { drm->primary_planes = drm->overlay_planes + drm->num_overlay_planes; drm->cursor_planes = drm->primary_planes + drm->num_primary_planes; + drmModeFreePlaneResources(plane_res); return true; error_planes: diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 58bd62f2..42c1eac9 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -33,6 +33,7 @@ static int wlr_libinput_readable(int fd, uint32_t mask, void *_state) { struct libinput_event *event; while ((event = libinput_get_event(state->libinput))) { wlr_libinput_event(state, event); + libinput_event_destroy(event); } return 0; } diff --git a/examples/shared.c b/examples/shared.c index 0605dd72..0738a548 100644 --- a/examples/shared.c +++ b/examples/shared.c @@ -311,6 +311,8 @@ static void keyboard_remove(struct wlr_input_device *device, struct compositor_s if (!kbstate) { return; } + xkb_state_unref(kbstate->xkb_state); + xkb_map_unref(kbstate->keymap); wl_list_remove(&kbstate->link); wl_list_remove(&kbstate->key.link); free(kbstate); -- cgit v1.2.3