[glade] GladePropertyClass: fix missing images data loss



commit 195fe472553d9c4850c1194dba1b11b628b76cff
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Sat Feb 24 11:16:10 2018 -0300

    GladePropertyClass: fix missing images data loss
    
    Make make_object_from_string() always return a different pixbuf for
    image properties to avoid loosing data by returning a copy
    of gtk_icon_theme_load_icon()
    
    Dix bug #772485 "File Name property of GtkImage is copied to all other GtkImage"

 gladeui/glade-property-class.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gladeui/glade-property-class.c b/gladeui/glade-property-class.c
index c82c642..d31d930 100644
--- a/gladeui/glade-property-class.c
+++ b/gladeui/glade-property-class.c
@@ -712,8 +712,11 @@ glade_property_class_make_object_from_string (GladePropertyClass *
 
       if ((pixbuf = gdk_pixbuf_new_from_file (fullpath, NULL)) == NULL)
         {
-          pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
-                                             "image-missing", 22, 0, NULL);
+          GdkPixbuf *icon = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+                                                      "image-missing", 22, 0, NULL);
+          /* Use a copy, since gtk_icon_theme_load_icon() returns the same pixbuf */
+          pixbuf = gdk_pixbuf_copy (icon);
+          g_object_unref (icon);
         }
 
       if (pixbuf)


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