[metacity] compositor: fix possible crash closing/destroying window
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] compositor: fix possible crash closing/destroying window
- Date: Thu, 9 Jul 2015 12:00:07 +0000 (UTC)
commit a9f28dbc26f5211ef08889109db3dc8c7ba76aca
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Jul 7 13:49:30 2015 +0300
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
src/compositor/compositor-private.h | 3 +++
src/compositor/compositor-xrender.c | 34 +++++++++++++++++++++++++---------
src/compositor/compositor.c | 4 ++++
3 files changed, 32 insertions(+), 9 deletions(-)
---
diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h
index 11ed73b..a45fdc9 100644
--- a/src/compositor/compositor-private.h
+++ b/src/compositor/compositor-private.h
@@ -48,6 +48,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 3bff70a..fbae9a7 100644
--- a/src/compositor/compositor-xrender.c
+++ b/src/compositor/compositor-xrender.c
@@ -2799,23 +2799,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,
@@ -3095,6 +3110,7 @@ static MetaCompositor comp_info = {
xrender_process_event,
xrender_get_window_pixmap,
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 0dcf2b2..1fea362 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -154,6 +154,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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]