[goffice] Fix criticals associated with GtkStyleContext destruction.



commit e3f0477cb92dcf347a5972c19634453569c30bf9
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sat Mar 15 14:31:10 2014 +0100

    Fix criticals associated with GtkStyleContext destruction.

 ChangeLog                   |    5 +++++
 goffice/canvas/goc-canvas.c |    6 ++++++
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f7023e9..dd35fa6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2014-03-15  Jean Brefort  <jean brefort normalesup org>
 
+       * goffice/canvas/goc-canvas.c (goc_canvas_dispose): fix criticals related
+       to style contexts destruction.
+
+2014-03-15  Jean Brefort  <jean brefort normalesup org>
+
        * goffice/canvas/goc-canvas.c (goc_canvas_init): really accept leave_notify
        events. [#668103][see also #706659]
 
diff --git a/goffice/canvas/goc-canvas.c b/goffice/canvas/goc-canvas.c
index 8bb5d1d..cf9a26b 100644
--- a/goffice/canvas/goc-canvas.c
+++ b/goffice/canvas/goc-canvas.c
@@ -250,7 +250,13 @@ static void
 goc_canvas_dispose (GObject *obj)
 {
        GocCanvas *canvas = GOC_CANVAS (obj);
+       GtkStyleContext *context = goc_item_get_style_context (GOC_ITEM (canvas->root));
        goc_group_clear (canvas->root);
+       /* we need to set the parent context to NULL for root before unrefing it
+        * because Gtk+ calls the "changed" signal when the parent is set to
+        * NULL from gtk_style_context_finalize(), and as the ref_count is already
+        * NULL, this fires criticals. */
+       gtk_style_context_set_parent (context, NULL);
        parent_klass->dispose (obj);
 }
 


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