GNOME Bugzilla – Bug 775316
gtk_drag_source_set_icon_pixbuf references the pixbuf received once too much
Last modified: 2016-12-15 09:43:15 UTC
To reproduce, after setting GOBJECT_DEBUG=objects, run gtk3-icon-browser, click n times on the same icon in the icon-view and close n times the dialog showing icon details. In the output there are 5 stale pixbufs with a ref_count > n. Repeating the test doubling n, the ref_count increases of n. The problem is here: https://git.gnome.org/browse/gtk+/tree/demos/icon-browser/iconbrowserwin.c?h=gtk-3-22#n84 gtk_drag_source_set_icon_pixbuf https://git.gnome.org/browse/gtk+/tree/gtk/gtkdragsource.c?h=gtk-3-22#n364 references the pixbuf and then calls gtk_image_definition_new_pixbuf which adds its own reference to the pixbuf, reference removed when gtk_image_definition_unref is called. I think that the g_object_ref is a leftover since this commit: https://git.gnome.org/browse/gtk+/commit/gtk/gtkdnd.c?h=gtk-3-22&id=adbfbb72783dccaeac773a8878e66d2300996f1e The g_object_ref is now part of gtk_image_definition_new_pixbuf and if there is the possibility that pixuf is the same as the one stored in site->image_def with only one reference, then it is necessary to add a g_object_unref at the end of the function.
*** Bug 776124 has been marked as a duplicate of this bug. ***