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 602794 - gtk_recent_manager_get_default leaks
gtk_recent_manager_get_default leaks
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkRecent
2.90.x
Other All
: Normal trivial
: ---
Assigned To: gtk-bugs
Emmanuele Bassi (:ebassi)
Depends on:
Blocks:
 
 
Reported: 2009-11-24 03:16 UTC by Morten Welinder
Modified: 2010-10-22 11:10 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Morten Welinder 2009-11-24 03:16:39 UTC
The docs are explicit:

"The returned instance will be freed when you application terminates."

It doesn't seem to happen, though, and I see no mechanism implemented
that aims at making it happen.
Comment 1 Christian Dywan 2009-11-24 06:58:02 UTC
Looks like wrong documentation to me. The single is merely a static pointer. Further more the README says "the gtk_recent_manager_get_default() function is guaranteed to be valid for the entire lifetime of an application." which means there is no way to ever finalize it. Since GTK+ can't know when the application terminates.
Comment 2 Emmanuele Bassi (:ebassi) 2009-11-24 11:03:12 UTC
yep, this is a brainfart in the documentation - my bad.
Comment 3 Morten Welinder 2009-11-24 13:23:39 UTC
Well, it has been documented like this forever.  I.e., it has been documented
that you call use g_object_set_data_full and get your callback called
eventually.

> which means there is no way to ever finalize it. Since GTK+ can't know
> when the application terminates.

Of course there is!  g_atexit, if nothing else.
Comment 4 Christian Dywan 2009-11-24 13:37:10 UTC
Now I'm curious what your use case is. :)
Comment 5 Emmanuele Bassi (:ebassi) 2009-11-24 13:40:03 UTC
(In reply to comment #3)
> Well, it has been documented like this forever.  I.e., it has been documented
> that you call use g_object_set_data_full and get your callback called
> eventually.

yes, that was the error.

if you create a GtkRecentManager instance yourself, obviously, you control it so you can unref() it and get a notification.

> > which means there is no way to ever finalize it. Since GTK+ can't know
> > when the application terminates.
> 
> Of course there is!  g_atexit, if nothing else.

considering the amount of instances and memory that survives a gtk+ application I don't think that the default GtkRecentManager singleton should have a different behaviour than the rest of singletons - e.g. GtkIconTheme or all the GDK objects.

I'll fix the documentation.
Comment 6 Javier Jardón (IRC: jjardon) 2010-05-19 21:34:59 UTC
@Emmanuele: ping
Comment 7 Emmanuele Bassi (:ebassi) 2010-10-22 11:10:23 UTC
Documentation fixed.