[mutter] wayland/gtk-shell: Fix MetaWaylandGtkSurface leak on surface destroy
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland/gtk-shell: Fix MetaWaylandGtkSurface leak on surface destroy
- Date: Fri, 29 Jan 2021 16:49:18 +0000 (UTC)
commit b41c4aec2677a48e30a54f731b3d7ef9924b48ea
Author: Sebastian Keller <skeller gnome org>
Date: Tue Jun 9 04:07:52 2020 +0200
wayland/gtk-shell: Fix MetaWaylandGtkSurface leak on surface destroy
The MetaWaylandSurface corresponding to a MetaWaylandGtkSurface can be
destroyed before the MetaWaylandGtkSurface is destroyed. In its destroy
function MetaWaylandSurface however was unsetting the destructor of the
correspnding resource along with the gtk_surface1 interface
implementation. This was done to prevent further gtk_surface1 requests
on a NULLed MetaWaylandSurface, if it has been destroyed before the
MetaWaylandGtkSurface.
It would be enough to just unset the resource implementation, while
keeping the destructor to fix this leak. However the following commit
will rely on the implementation being available after the
MetaWaylandSurface has been destroyed. So instead introduce NULL checks
for all functions that can be called on the gtk_surface1 interface and
do not unset the implementation.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1307>
src/wayland/meta-wayland-gtk-shell.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c
index 9c5357b914..1fc74787b9 100644
--- a/src/wayland/meta-wayland-gtk-shell.c
+++ b/src/wayland/meta-wayland-gtk-shell.c
@@ -83,6 +83,9 @@ gtk_surface_set_dbus_properties (struct wl_client *client,
MetaWaylandSurface *surface = gtk_surface->surface;
MetaWindow *window;
+ if (!surface)
+ return;
+
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -104,6 +107,9 @@ gtk_surface_set_modal (struct wl_client *client,
MetaWaylandSurface *surface = gtk_surface->surface;
MetaWindow *window;
+ if (!surface)
+ return;
+
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -123,6 +129,9 @@ gtk_surface_unset_modal (struct wl_client *client,
MetaWaylandSurface *surface = gtk_surface->surface;
MetaWindow *window;
+ if (!surface)
+ return;
+
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -143,6 +152,9 @@ gtk_surface_present (struct wl_client *client,
MetaWaylandSurface *surface = gtk_surface->surface;
MetaWindow *window;
+ if (!surface)
+ return;
+
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -162,6 +174,9 @@ gtk_surface_request_focus (struct wl_client *client,
MetaStartupSequence *sequence = NULL;
MetaWindow *window;
+ if (!surface)
+ return;
+
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -204,8 +219,6 @@ static const struct gtk_surface1_interface meta_wayland_gtk_surface_interface =
static void
gtk_surface_surface_destroyed (MetaWaylandGtkSurface *gtk_surface)
{
- wl_resource_set_implementation (gtk_surface->resource,
- NULL, NULL, NULL);
gtk_surface->surface = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]