[gtk+] renderer: Assert having been unrealized in dispose



commit bd287ba3cf9293f360ea3f9093b8ef4389587f00
Author: Benjamin Otte <otte redhat com>
Date:   Sat Nov 4 15:09:43 2017 +0100

    renderer: Assert having been unrealized in dispose
    
    We cannot unrealize a renderer in the dispose function, because that
    would cause this chain to happen:
      gsk_gl_renderer_dispose
      gsk_renderer_dispose
      gsk_renderer_unrealize
      gsk_gl_renderer_unrealize
    So we would call into thje GL renderers unrealize when it has already
    (partially) disposed itself and ause accesses to dead variables.

 gsk/gskrenderer.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c
index c04bbc3..a769bd4 100644
--- a/gsk/gskrenderer.c
+++ b/gsk/gskrenderer.c
@@ -170,7 +170,9 @@ gsk_renderer_dispose (GObject *gobject)
   GskRenderer *self = GSK_RENDERER (gobject);
   GskRendererPrivate *priv = gsk_renderer_get_instance_private (self);
 
-  gsk_renderer_unrealize (self);
+  /* We can't just unrealize here because superclasses have already run dispose.
+   * So we insist that unrealize must be called before unreffing. */
+  g_assert (!priv->is_realized);
 
   g_clear_object (&priv->profiler);
   g_clear_object (&priv->display);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]