[gtk: 1/2] gdk/wayland: Clean up gestures if pointer capability is withdrawn
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] gdk/wayland: Clean up gestures if pointer capability is withdrawn
- Date: Wed, 21 Jul 2021 21:33:54 +0000 (UTC)
commit 2c023cdaede89bd2063baab4767c9f5c61b37378
Author: Vlad Zahorodnii <vlad zahorodnii kde org>
Date: Tue Jun 22 09:23:42 2021 +0300
gdk/wayland: Clean up gestures if pointer capability is withdrawn
If the pointer capability is added, pointer swipe and pinch gestures
will be created. However, if the pointer capability is removed, the
gesture objects won't be destroyed.
If the pointer capability is removed and added several times in a row,
for example due to plugging and unplugging physical mouse, this can lead
to leaking the old gesture objects.
In order to prevent that, this change makes the seat destroy swipe and
pinch gestures when the pointer capability is withdrawn.
gdk/wayland/gdkdevice-wayland.c | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index ca94a6e7e5..1ee83984da 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -3093,6 +3093,11 @@ seat_handle_capabilities (void *data,
}
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && seat->wl_pointer)
{
+ g_clear_pointer (&seat->wp_pointer_gesture_swipe,
+ zwp_pointer_gesture_swipe_v1_destroy);
+ g_clear_pointer (&seat->wp_pointer_gesture_pinch,
+ zwp_pointer_gesture_pinch_v1_destroy);
+
wl_pointer_release (seat->wl_pointer);
seat->wl_pointer = NULL;
gdk_seat_device_removed (GDK_SEAT (seat), seat->pointer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]