GNOME Bugzilla – Bug 602794
gtk_recent_manager_get_default leaks
Last modified: 2010-10-22 11:10:23 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.
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.
yep, this is a brainfart in the documentation - my bad.
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.
Now I'm curious what your use case is. :)
(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.
@Emmanuele: ping
Documentation fixed.