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 308291 - [PATCH] Leak in egg-recent-view-gtk
[PATCH] Leak in egg-recent-view-gtk
Status: RESOLVED FIXED
Product: libegg
Classification: Other
Component: recent-files
unspecified
Other Linux
: High normal
: ---
Assigned To: Emmanuele Bassi (:ebassi)
Libegg maintenance
Depends on:
Blocks:
 
 
Reported: 2005-06-19 13:06 UTC by Nickolay V. Shmyrev
Modified: 2005-12-22 11:19 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Nickolay V. Shmyrev 2005-06-19 13:06:41 UTC
Valgrind record:

==1542== 25088 bytes in 17 blocks are still reachable in loss record 177 of 186
==1542==    at 0x3414723C: malloc (vg_replace_malloc.c:131)
==1542==    by 0x7E79373: g_try_malloc (in /usr/lib/libglib-2.0.so.0.600.3)
==1542==    by 0x97B7E3: gdk_pixbuf_new (in /usr/lib/libgdk_pixbuf-2.0.so.0.600.7)
==1542==    by 0x98122F: gdk_pixbuf_loader_close (in
/usr/lib/libgdk_pixbuf-2.0.so.0.600.7)
==1542==    by 0x97ED17: gdk_pixbuf_new_from_file_at_scale (in
/usr/lib/libgdk_pixbuf-2.0.so.0.600.7)
==1542==    by 0x97EE9E: gdk_pixbuf_new_from_file_at_size (in
/usr/lib/libgdk_pixbuf-2.0.so.0.600.7)
==1542==    by 0x807901C: load_icon_file (egg-recent-util.c:68)


Patch:
Index: cut-n-paste/recent-files/egg-recent-view-gtk.c
===================================================================
RCS file: /cvs/gnome/evince/cut-n-paste/recent-files/egg-recent-view-gtk.c,v
retrieving revision 1.4
diff -u -p -r1.4 egg-recent-view-gtk.c
--- cut-n-paste/recent-files/egg-recent-view-gtk.c      18 Jun 2005 10:32:47
-00+++ cut-n-paste/recent-files/egg-recent-view-gtk.c      19 Jun 2005 12:30:29
-00@@ -523,6 +523,8 @@ egg_recent_view_gtk_finalize (GObject *o
        g_object_unref (view->client);

        g_object_unref (view->tooltips);
+
+       egg_recent_view_gtk_clear (view);
 }

 static void
Comment 1 Christian Kirbach 2005-06-19 14:19:39 UTC
Thanks for sending in.
Raising priority to make maintainers aware of patch.
Adding PATCH keyword.
Comment 2 Emmanuele Bassi (:ebassi) 2005-07-02 09:31:48 UTC
committed, thanks
Comment 3 Nickolay V. Shmyrev 2005-07-02 10:47:55 UTC
Sorry, Emmanuele, but it seems that you should revert this patch. The problem 
is that clear_view_gtk method refers to childred of container. In finalize, this
behaviour is invalid. You should do earlier, when childrens are not destroed
yet. Otherwise you'll probably get a segfault.
Comment 4 Emmanuele Bassi (:ebassi) 2005-07-03 01:20:15 UTC
I've tried it before commit, in combination with other patches, and it did not
segfault (the children are removed and disposed only if found, so it ends up
doing nothing if the children have already been destroyed), so the worst thing
that should happen is that the leak is still there.

Fact is, the disposal of our children should be done in a ::destroy function,
but since EggRecentViewGtk is not a GtkWidget subclass, we do not have it.

I've placed the call to _view_gtk_clear right after the signal disconnect inside
_view_gtk_finalize, and checked that it doesn't segfault.  I don't have valgrind
installed on this machine, could you please check if there's still a leak?
Comment 5 Emmanuele Bassi (:ebassi) 2005-12-22 11:19:44 UTC
valgrind doesn't report this leak anymore, so I'm closing this one.