[libadwaita/wip/exalm/shader-crash: 2/3] fading-label: Free the shader in unrealize() instead of dispose()




commit 24455c01a09a3602baaee0f0ababdd228d8d19e4
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Jul 20 13:25:28 2021 +0500

    fading-label: Free the shader in unrealize() instead of dispose()

 src/adw-fading-label.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/adw-fading-label.c b/src/adw-fading-label.c
index 3dbcb6ce..5aeb6eb0 100644
--- a/src/adw-fading-label.c
+++ b/src/adw-fading-label.c
@@ -171,6 +171,16 @@ adw_fading_label_snapshot (GtkWidget   *widget,
   gtk_snapshot_pop (snapshot);
 }
 
+static void
+adw_fading_label_unrealize (GtkWidget *widget)
+{
+  AdwFadingLabel *self = ADW_FADING_LABEL (widget);
+
+  GTK_WIDGET_CLASS (adw_fading_label_parent_class)->unrealize (widget);
+
+  g_clear_object (&self->shader);
+}
+
 static void
 adw_fading_label_get_property (GObject    *object,
                                guint       prop_id,
@@ -220,7 +230,6 @@ adw_fading_label_dispose (GObject *object)
 {
   AdwFadingLabel *self = ADW_FADING_LABEL (object);
 
-  g_clear_object (&self->shader);
   g_clear_pointer (&self->label, gtk_widget_unparent);
 
   G_OBJECT_CLASS (adw_fading_label_parent_class)->dispose (object);
@@ -239,6 +248,7 @@ adw_fading_label_class_init (AdwFadingLabelClass *klass)
   widget_class->measure = adw_fading_label_measure;
   widget_class->size_allocate = adw_fading_label_size_allocate;
   widget_class->snapshot = adw_fading_label_snapshot;
+  widget_class->unrealize = adw_fading_label_unrealize;
 
   props[PROP_LABEL] =
     g_param_spec_string ("label",


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