summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2019-06-28 09:45:22 +0000
committerMarco Trevisan <mail@3v1n0.net>2019-06-28 17:47:01 +0000
commit947da2c5d583ea7ac743238fe0022f7c4a0d5356 (patch)
tree1682b1b7c39e9c40a98c365c80c44a903a950064
parent0a8fbbe5cc5d5bc06e2630b391849e5f9c4db5ad (diff)
downloadmutter-947da2c5d583ea7ac743238fe0022f7c4a0d5356.tar.gz
surface-actor-x11: Bind the surface actor resources to window actor life
X11 actors need to release the server data (pixmap and damage) before the display is closed. During the close phase all the windows are unmanaged and this causes the window actors to be removed from the compositor, unsetting their actor surface. However, in case a window is animating the surface might not be destroyed until the animation is completed and a reference to it kept around by gjs in the shell case. By the way, per commit 7718e67f all window actors (even the animating ones) are destroyed before the display is closed, but this is not true for the child surface, because the parent window will just unref it, leaving it around if reffed somewhere else. This is fine for wayland surfaces, but not for X11 ones which are bound to server-side pixmaps. So, connect to the parent MetaWindowActor "destroy" signal, releasing the x11 resources that implies detaching the pixmap (unsetting the texture) and removing the damages. Closes: https://gitlab.gnome.org/GNOME/mutter/issues/629 https://gitlab.gnome.org/GNOME/mutter/merge_requests/660 (cherry picked from commit de97b54595cf4662c437fecf26ca2e08339a13a3)
-rw-r--r--src/compositor/meta-surface-actor-x11.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/compositor/meta-surface-actor-x11.c b/src/compositor/meta-surface-actor-x11.c
index 341bd8b83..52fe1a219 100644
--- a/src/compositor/meta-surface-actor-x11.c
+++ b/src/compositor/meta-surface-actor-x11.c
@@ -32,6 +32,7 @@
#include "cogl/winsys/cogl-texture-pixmap-x11.h"
#include "compositor/meta-cullable.h"
#include "compositor/meta-shaped-texture-private.h"
+#include "compositor/meta-window-actor-private.h"
#include "core/window-private.h"
#include "meta/meta-x11-errors.h"
#include "x11/meta-x11-display-private.h"
@@ -348,12 +349,18 @@ meta_surface_actor_x11_is_unredirected (MetaSurfaceActor *actor)
}
static void
+release_x11_resources (MetaSurfaceActorX11 *self)
+{
+ detach_pixmap (self);
+ free_damage (self);
+}
+
+static void
meta_surface_actor_x11_dispose (GObject *object)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (object);
- detach_pixmap (self);
- free_damage (self);
+ release_x11_resources (self);
G_OBJECT_CLASS (meta_surface_actor_x11_parent_class)->dispose (object);
}
@@ -407,8 +414,7 @@ window_decorated_notify (MetaWindow *window,
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (user_data);
- detach_pixmap (self);
- free_damage (self);
+ release_x11_resources (self);
create_damage (self);
}
@@ -445,6 +451,10 @@ meta_surface_actor_x11_new (MetaWindow *window)
g_signal_connect_object (self->window, "notify::decorated",
G_CALLBACK (window_decorated_notify), self, 0);
+ g_signal_connect_object (meta_window_actor_from_window (window), "destroy",
+ G_CALLBACK (release_x11_resources), self,
+ G_CONNECT_SWAPPED);
+
self->unredirected = FALSE;
sync_unredirected (self);