[hafqa] [hafqa] [Bug 867] New: hildon_program_get_instance(): unclear refcounting

From: bugzilla-daemon at maemo.org bugzilla-daemon at maemo.org
Date: Mon Nov 20 18:23:22 EET 2006
https://maemo.org/bugzilla/show_bug.cgi?id=867

           Summary: hildon_program_get_instance(): unclear refcounting
           Product: haf
           Version: sardine
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: hildon-libs
        AssignedTo: michael.kostrzewa at nokia.com
        ReportedBy: murrayc at murrayc.com
         QAContact: hafqa at maemo.org


The documentation (and implementation, I think) of hildon_program_get_instance()
is unclear about the refcounting that should be done.

- Most *_get_*() functions that return a GObject require the caller to a a
g_object_ref() of the object if they wish to keep using the object. Only if the
caller does a g_object_ref() is a g_object_unref() necessary
- Most *_new() functions provide an initial reference, and always require the
caller to do a g_object_unref() on the returned GObject.

However, the documentation for hildon_program_get_instance() seems to be saying
approx. "The first time you call this function, you'll be given a reference
(which you should unref when quiting your application?). But on subsequent calls
you will not be given a reference." This is awkward and likely to lead to
excessive refs or unrefs, or not enough.

Or is it OK to always leak that initial ref() from g_object_new(), so that the
HildonProgram finalize() function is never called?

-- 
Configure bugmail: https://maemo.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.

More information about the hafqa mailing list