After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 775316 - gtk_drag_source_set_icon_pixbuf references the pixbuf received once too much
gtk_drag_source_set_icon_pixbuf references the pixbuf received once too much
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 776124 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-11-29 11:57 UTC by Massimo
Modified: 2016-12-15 09:43 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Massimo 2016-11-29 11:57:48 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.
Comment 1 Debarshi Ray 2016-12-15 09:43:15 UTC
*** Bug 776124 has been marked as a duplicate of this bug. ***