[mutter] MetaWaylandSurface: Move destroy signal even earlier



commit fccdd00f743afad2f3ce2aaa25e1a1c38b58d13b
Author: Jonas Ådahl <jadahl gmail com>
Date:   Tue Sep 6 12:41:49 2016 +0800

    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 bfddef7..99e3dfd 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
@@ -1759,20 +1761,6 @@ meta_wayland_surface_get_absolute_coordinates (MetaWaylandSurface *surface,
 }
 
 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)
 {
   surface->pending = g_object_new (META_TYPE_WAYLAND_PENDING_STATE, NULL);
@@ -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 1682fb6..bac94c3 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 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]