diff options
author | Matthias Clasen <mclasen@redhat.com> | 2023-02-19 12:44:30 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2023-02-19 12:44:30 -0500 |
commit | 996798b901496a25a49122285d285415f18705dd (patch) | |
tree | 4ab4a9623820ee7e52ac849498d7b92d8c4114f5 | |
parent | 9d6a67e3bf1064cf31a8262c551a3b984658e400 (diff) | |
download | gtk+-fix-image-clear-use.tar.gz |
image: Stop using gtk_image_clear in finalizefix-image-clear-use
This causes criticals with recent glib.
So do the same things clear() does, manually.
-rw-r--r-- | gtk/gtkimage.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index db99d57713..705818fd84 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -290,12 +290,35 @@ gtk_image_init (GtkImage *image) image->icon_helper = gtk_icon_helper_new (widget_node, GTK_WIDGET (image)); } +static void gtk_image_paintable_invalidate_contents (GdkPaintable *paintable, + GtkImage *image); + +static void gtk_image_paintable_invalidate_size (GdkPaintable *paintable, + GtkImage *image); + static void gtk_image_finalize (GObject *object) { GtkImage *image = GTK_IMAGE (object); - gtk_image_clear (image); + g_free (image->filename); + g_free (image->resource_path); + + if (_gtk_icon_helper_get_storage_type (image->icon_helper) == GTK_IMAGE_PAINTABLE) + { + GdkPaintable *paintable = _gtk_icon_helper_peek_paintable (image->icon_helper); + const guint flags = gdk_paintable_get_flags (paintable); + + if ((flags & GDK_PAINTABLE_STATIC_CONTENTS) == 0) + g_signal_handlers_disconnect_by_func (paintable, + gtk_image_paintable_invalidate_contents, + image); + + if ((flags & GDK_PAINTABLE_STATIC_SIZE) == 0) + g_signal_handlers_disconnect_by_func (paintable, + gtk_image_paintable_invalidate_size, + image); + } g_clear_object (&image->icon_helper); |