summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-05-30 15:09:05 -0400
committerVictor Kareh <[email protected]>2019-06-05 10:49:37 -0400
commitdf56628979abc17474b001c58c28c6f3637ada9d (patch)
treed9edaf00644eff8b248f1fb637f9ba8f2d9bfda6
parentda5dce7c6f30018b00846c4332a2c06a4b95ffc0 (diff)
downloadmarco-df56628979abc17474b001c58c28c6f3637ada9d.tar.bz2
marco-df56628979abc17474b001c58c28c6f3637ada9d.tar.xz
compositor: fix possible crash closing/destroying window
Partially restore call to destroy_win in compositor when calling meta_window_free. This is needed to ensure that we never call meta_window_get_frame_bounds while windows is destroying. https://bugzilla.gnome.org/show_bug.cgi?id=751833 upstream commit: https://gitlab.gnome.org/GNOME/metacity/commit/a9f28dbc
-rw-r--r--src/compositor/compositor-private.h3
-rw-r--r--src/compositor/compositor-xrender.c34
-rw-r--r--src/compositor/compositor.c4
3 files changed, 32 insertions, 9 deletions
diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h
index fcb15187..1fa64695 100644
--- a/src/compositor/compositor-private.h
+++ b/src/compositor/compositor-private.h
@@ -50,6 +50,9 @@ struct _MetaCompositor
MetaScreen *screen,
MetaWindow *window);
+ void (*free_window) (MetaCompositor *compositor,
+ MetaWindow *window);
+
void (*maximize_window) (MetaCompositor *compositor,
MetaWindow *window);
void (*unmaximize_window) (MetaCompositor *compositor,
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c
index dc7ac15f..abcf51ae 100644
--- a/src/compositor/compositor-xrender.c
+++ b/src/compositor/compositor-xrender.c
@@ -3040,23 +3040,38 @@ xrender_end_move (MetaCompositor *compositor,
#ifdef HAVE_COMPOSITE_EXTENSIONS
#endif
}
+#endif /* 0 */
static void
xrender_free_window (MetaCompositor *compositor,
MetaWindow *window)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
- /* FIXME: When an undecorated window is hidden this is called,
- but the window does not get readded if it is subsequentally shown again
- See http://bugzilla.gnome.org/show_bug.cgi?id=504876
-
- I don't *think* theres any need for this call anyway, leaving it out
- does not seem to cause any side effects so far, but I should check with
- someone who understands more. */
- /* destroy_win (compositor->display, window->xwindow, FALSE); */
+ MetaCompositorXRender *xrc;
+ MetaFrame *frame;
+ Window xwindow;
+
+ xrc = (MetaCompositorXRender *) compositor;
+ frame = meta_window_get_frame (window);
+ xwindow = None;
+
+ if (frame)
+ {
+ xwindow = meta_frame_get_xwindow (frame);
+ }
+ else
+ {
+ /* FIXME: When an undecorated window is hidden this is called, but the
+ * window does not get readded if it is subsequentally shown again. See:
+ * http://bugzilla.gnome.org/show_bug.cgi?id=504876
+ */
+ /* xwindow = meta_window_get_xwindow (window); */
+ }
+
+ if (xwindow != None)
+ destroy_win (xrc->display, xwindow, FALSE);
#endif
}
-#endif /* 0 */
static void
xrender_process_event (MetaCompositor *compositor,
@@ -3360,6 +3375,7 @@ static MetaCompositor comp_info = {
xrender_process_event,
xrender_get_window_surface,
xrender_set_active_window,
+ xrender_free_window,
xrender_maximize_window,
xrender_unmaximize_window,
};
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 7e3c79c2..39344e82 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -156,6 +156,10 @@ void meta_compositor_end_move (MetaCompositor *compositor,
void meta_compositor_free_window (MetaCompositor *compositor,
MetaWindow *window)
{
+#ifdef HAVE_COMPOSITE_EXTENSIONS
+ if (compositor && compositor->free_window)
+ compositor->free_window (compositor, window);
+#endif
}
void