[gtk/otte-main-patch-86462] snapshot: Don't critical on dispose



commit dbab69c453fbba563d126efcd23aea4d04f32327
Author: Benjamin Otte <otte benjamin googlemail com>
Date:   Mon Aug 1 20:28:46 2022 +0000

    snapshot: Don't critical on dispose
    
    When there's remaining state that draws nothing, it returns no
    rendernode. So do a NULL-check before unreffing it.

 gtk/gtksnapshot.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index 1896a207de..afa27b45f1 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -163,7 +163,10 @@ gtk_snapshot_dispose (GObject *object)
   GtkSnapshot *snapshot = GTK_SNAPSHOT (object);
 
   if (!gtk_snapshot_states_is_empty (&snapshot->state_stack))
-    gsk_render_node_unref (gtk_snapshot_to_node (snapshot));
+    {
+      GskRenderNode *node = gtk_snapshot_to_node (snapshot);
+      g_clear_pointer (&node, gsk_render_node_unref);
+    }
 
   g_assert (gtk_snapshot_states_is_empty (&snapshot->state_stack));
   g_assert (gtk_snapshot_nodes_is_empty (&snapshot->nodes));


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