Blob Blame History Raw
From 68bdb7ef345a2887ca8570fadbdca81404899b0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Thu, 25 Jul 2019 02:10:07 +0200
Subject: [PATCH 27/28] window-actor: Unset the window compositor private on
 destruction

A window actor could be destroyed before than the related Window (if for
example, it is explicitly removed from the stage or destroyed), in such case
we need to unset the compositor private for the window on disposition, or once
the window is actually destroyed, we will try to access to an invalid pointer,
and to remove an invalid window actor from the compositor.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/682
---
 src/compositor/meta-window-actor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index f1f86e14b..39198dbe1 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -480,60 +480,61 @@ meta_window_actor_constructed (GObject *object)
 }
 
 static void
 meta_window_actor_dispose (GObject *object)
 {
   MetaWindowActor *self = META_WINDOW_ACTOR (object);
   MetaWindowActorPrivate *priv = self->priv;
   MetaCompositor *compositor = priv->compositor;
 
   if (priv->disposed)
     return;
 
   priv->disposed = TRUE;
 
   if (priv->send_frame_messages_timer != 0)
     {
       g_source_remove (priv->send_frame_messages_timer);
       priv->send_frame_messages_timer = 0;
     }
 
   g_clear_pointer (&priv->shape_region, cairo_region_destroy);
   g_clear_pointer (&priv->shadow_clip, cairo_region_destroy);
 
   g_clear_pointer (&priv->shadow_class, g_free);
   g_clear_pointer (&priv->focused_shadow, meta_shadow_unref);
   g_clear_pointer (&priv->unfocused_shadow, meta_shadow_unref);
   g_clear_pointer (&priv->shadow_shape, meta_window_shape_unref);
 
   compositor->windows = g_list_remove (compositor->windows, (gconstpointer) self);
 
+  meta_window_set_compositor_private (priv->window, NULL);
   g_clear_object (&priv->window);
 
   set_surface (self, NULL);
 
   G_OBJECT_CLASS (meta_window_actor_parent_class)->dispose (object);
 }
 
 static void
 meta_window_actor_finalize (GObject *object)
 {
   MetaWindowActor        *self = META_WINDOW_ACTOR (object);
   MetaWindowActorPrivate *priv = self->priv;
 
   g_list_free_full (priv->frames, (GDestroyNotify) frame_data_free);
 
   G_OBJECT_CLASS (meta_window_actor_parent_class)->finalize (object);
 }
 
 static void
 meta_window_actor_set_property (GObject      *object,
                                 guint         prop_id,
                                 const GValue *value,
                                 GParamSpec   *pspec)
 {
   MetaWindowActor        *self   = META_WINDOW_ACTOR (object);
   MetaWindowActorPrivate *priv = self->priv;
 
   switch (prop_id)
     {
     case PROP_META_WINDOW:
-- 
2.26.2