diff options
author | FORT David <rdp.effort@gmail.com> | 2015-10-09 18:17:43 +0200 |
---|---|---|
committer | Derek Foreman <derekf@osg.samsung.com> | 2015-10-09 15:23:08 -0500 |
commit | f7bb9352f7d2a17419b4ff8fa800a34da5148c0b (patch) | |
tree | 480d9940ddabd0586e030e44f22102100e399391 /clients | |
parent | d669714d7161d90e04879eae03a129e7f240b948 (diff) | |
download | weston-f7bb9352f7d2a17419b4ff8fa800a34da5148c0b.tar.gz |
weston: release keyboard/touch/pointer objects
This patch adds the missing calls to release when the seat has capabilities
changes. It also fixes a missing release of the touch object and a leak with
old clients.
Signed-off-by: David FORT <contact@hardening-consulting.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'clients')
-rw-r--r-- | clients/window.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/clients/window.c b/clients/window.c index 47a79aa6..6d3e9442 100644 --- a/clients/window.c +++ b/clients/window.c @@ -3256,7 +3256,10 @@ seat_handle_capabilities(void *data, struct wl_seat *seat, wl_pointer_add_listener(input->pointer, &pointer_listener, input); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) { - wl_pointer_destroy(input->pointer); + if (input->display->seat_version >= WL_POINTER_RELEASE_SINCE_VERSION) + wl_pointer_release(input->pointer); + else + wl_pointer_destroy(input->pointer); input->pointer = NULL; } @@ -3266,7 +3269,10 @@ seat_handle_capabilities(void *data, struct wl_seat *seat, wl_keyboard_add_listener(input->keyboard, &keyboard_listener, input); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) { - wl_keyboard_destroy(input->keyboard); + if (input->display->seat_version >= WL_KEYBOARD_RELEASE_SINCE_VERSION) + wl_keyboard_release(input->keyboard); + else + wl_keyboard_destroy(input->keyboard); input->keyboard = NULL; } @@ -3275,7 +3281,10 @@ seat_handle_capabilities(void *data, struct wl_seat *seat, wl_touch_set_user_data(input->touch, input); wl_touch_add_listener(input->touch, &touch_listener, input); } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) { - wl_touch_destroy(input->touch); + if (input->display->seat_version >= WL_TOUCH_RELEASE_SINCE_VERSION) + wl_touch_release(input->touch); + else + wl_touch_destroy(input->touch); input->touch = NULL; } } @@ -5269,11 +5278,20 @@ input_destroy(struct input *input) else wl_data_device_destroy(input->data_device); } - if (input->display->seat_version >= 3) { + if (input->display->seat_version >= WL_POINTER_RELEASE_SINCE_VERSION) { + if (input->touch) + wl_touch_release(input->touch); if (input->pointer) wl_pointer_release(input->pointer); if (input->keyboard) wl_keyboard_release(input->keyboard); + } else { + if (input->touch) + wl_touch_destroy(input->touch); + if (input->pointer) + wl_pointer_destroy(input->pointer); + if (input->keyboard) + wl_keyboard_destroy(input->keyboard); } fini_xkb(input); |