Re: ref_count



Deborah Swayne <dfs research att com> writes:

> Is it appropriate to look at a gobject's ref_count, or is
> that supposed to be private?  I've been keeping track of its
> value whenever I deliberately increment or decrement it, but the
> code makes it look as though I'm doing something improper -- and
> likely to be disabled.  Is there some equivalent of a
> g_object_get_ref_count function that I just haven't spotted?

Looking at an object's reference count is _generally_ a sign
of doing something wrong [*]... after all, only some of the reference
count represents references you own, other parts of the reference
count reperesent references other people own.

It's hard to say more without knowing what you are doing in detail.

Regards,
                                        Owen

[*] The one exception I'm aware of is that sometimes when writing
    language bindings, you want to explicitly catch:

                           ----------------------\/
      Language proxy object                        Gobject
                          /\-----------------------

    cycles, which, if both sides are refcounted, can be detected
    as a refcount of 1 for both objects.



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