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
This commit is contained in:
Jonas Ådahl 2016-09-06 12:41:49 +08:00
parent 3a41b0f221
commit fccdd00f74
2 changed files with 2 additions and 17 deletions

View File

@ -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),

View File

@ -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 {