gconf_client_get_default() usage and refcounts



Hi.

There's a bugreport in bugzilla saying that this function returning a
refcount is broken broken broken. Looking at the use of it we have a lot
of dubious stuff in CVS.

- gnome-app.c uses this without calling g_object_unref() after finishing
- gnome-app-helper.c calls g_object_ref() on the returned object before
calling g_object_data_set_full() with a g_object_unref() callback on it
in some cases, in other cases it doesn't call g_object_ref() before
doing the same thing. In neither of these cases is the original refcount
lowered.
- gnome-entry.c does not call g_object_unref() after doing its thing
- gnome-gconf-ui.c has this:

        /* Leak the GConfClient reference, we want to keep
         * the client alive forever.
         */

- gnome-thumbnail.c seems to do the right thing
- gnome-ui-init.c does not g_object_unref() the client

In some cases we do g_object_unref (G_OBJECT (client)); and others do
not use the cast.

Maybe a case where we need a guideline and someone to audit all uses of
this function?

Cheers
Kjartan





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]