mutter/mutter-3.26.0-do-not-leak-shortcut-inhibit-data.patch

57 lines
2.1 KiB
Diff
Raw Normal View History

From b8840456a593b1878d0f9c5cb22c271be7d09c94 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Tue, 12 Sep 2017 10:27:32 +0200
Subject: [PATCH] wayland: do not leak shortcut inhibit data
We would free the shortcut inhibit data only when the client destroys
its request, which is not the case when the clients itself is
destroyed, leading to a leak of the shortcut inhibit data.
Free the data on resource destruction instead, and simply destroy the
resource on destroy request.
https://bugzilla.gnome.org/show_bug.cgi?id=787568
---
src/wayland/meta-wayland-inhibit-shortcuts.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/wayland/meta-wayland-inhibit-shortcuts.c b/src/wayland/meta-wayland-inhibit-shortcuts.c
index a7ba3c211..8e5ed2413 100644
--- a/src/wayland/meta-wayland-inhibit-shortcuts.c
+++ b/src/wayland/meta-wayland-inhibit-shortcuts.c
@@ -41,8 +41,7 @@ struct _MetaWaylandKeyboardShotscutsInhibit
};
static void
-zwp_keyboard_shortcuts_inhibit_destroy (struct wl_client *client,
- struct wl_resource *resource)
+zwp_keyboard_shortcuts_inhibit_destructor (struct wl_resource *resource)
{
MetaWaylandKeyboardShotscutsInhibit *shortcut_inhibit;
@@ -64,6 +63,12 @@ zwp_keyboard_shortcuts_inhibit_destroy (struct wl_client *client,
shortcut_inhibit->seat);
}
g_free (shortcut_inhibit);
+}
+
+static void
+zwp_keyboard_shortcuts_inhibit_destroy (struct wl_client *client,
+ struct wl_resource *resource)
+{
wl_resource_destroy (resource);
}
@@ -148,7 +153,7 @@ zwp_keyboard_shortcuts_inhibit_manager_inhibit_shortcuts (struct wl_client *cl
wl_resource_set_implementation (keyboard_shortcuts_inhibit_resource,
&meta_keyboard_shortcuts_inhibit_interface,
shortcut_inhibit,
- NULL);
+ zwp_keyboard_shortcuts_inhibit_destructor);
}
static const struct zwp_keyboard_shortcuts_inhibit_manager_v1_interface
--
2.13.5