From fccdd00f743afad2f3ce2aaa25e1a1c38b58d13b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 6 Sep 2016 12:41:49 +0800 Subject: [PATCH] MetaWaylandSurface: Move destroy signal even earlier Move the MetaWaylandSurface::destroy signal before starting the actual destruction, in wl_surface_destructor, so that all fields (e.g. surface role) are intact when the listeners are invoked. https://bugzilla.gnome.org/show_bug.cgi?id=771050 --- src/wayland/meta-wayland-surface.c | 18 ++---------------- src/wayland/meta-wayland-surface.h | 1 - 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index bfddef7e0..99e3dfd9e 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -1216,6 +1216,8 @@ wl_surface_destructor (struct wl_resource *resource) MetaWaylandCompositor *compositor = surface->compositor; MetaWaylandFrameCallback *cb, *next; + g_signal_emit (surface, surface_signals[SURFACE_DESTROY], 0); + g_clear_object (&surface->role); /* If we still have a window at the time of destruction, that means that @@ -1758,20 +1760,6 @@ meta_wayland_surface_get_absolute_coordinates (MetaWaylandSurface *surface, *y = v.y; } -static void -meta_wayland_surface_dispose (GObject *object) -{ - MetaWaylandSurface *surface = META_WAYLAND_SURFACE (object); - - if (!surface->destroying) - { - g_signal_emit (object, surface_signals[SURFACE_DESTROY], 0); - surface->destroying = TRUE; - } - - G_OBJECT_CLASS (meta_wayland_surface_parent_class)->dispose (object); -} - static void meta_wayland_surface_init (MetaWaylandSurface *surface) { @@ -1783,8 +1771,6 @@ meta_wayland_surface_class_init (MetaWaylandSurfaceClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->dispose = meta_wayland_surface_dispose; - surface_signals[SURFACE_DESTROY] = g_signal_new ("destroy", G_TYPE_FROM_CLASS (object_class), diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h index 1682fb657..bac94c396 100644 --- a/src/wayland/meta-wayland-surface.h +++ b/src/wayland/meta-wayland-surface.h @@ -184,7 +184,6 @@ struct _MetaWaylandSurface int32_t offset_x, offset_y; GList *subsurfaces; GHashTable *outputs_to_destroy_notify_id; - gboolean destroying; /* Buffer reference state. */ struct {