Re: gobject ref and unref ?
- From: Siddu <siddu sjce gmail com>
- To: Tadej Borovšak <tadeboro gmail com>
- Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>, gtk-list <gtk-list gnome org>
- Subject: Re: gobject ref and unref ?
- Date: Wed, 11 Nov 2009 00:04:54 +0530
That was pretty neat thanks.
On 11/10/09, Tadej Borovšak <tadeboro gmail com> wrote:
> Hello.
>
>> Is there any documentation available for it ? as to when to ref and
>> unref it based upon the api's ?
>
> You don't need to know those things, since object's total reference
> count is of no importance to you. All you need to do is keep track of
> your own references on an object. Let me explain this based on your
> example.
>
> When you create new store for GtkTreeView (be it GtkListStore or
> GtkTreeStore), you get an object that has a reference count of 1 and
> this reference is owned by you and is the only thing that is keeping
> you newly created object "alive". Now you add this store to the
> GtkTreeView, which is from now "co-owner" of the store. I
> intentionally co-owner in last sentence, because you don't need to
> know what exactly GtkTreeView does to claim ownership (it can add 1, 2
> or 10 references if it needs to). If you don't need created store for
> anything else, you can now remove your own reference from it, which
> essentially makes GtkTreeView the only "owner" of the store.
>
> You can see that no explicit reference counting wizardry is needed to
> properly count references. Just make sure your own references are
> removed when you don't need an object to stick around.
>
> Tadej
>
>
> --
> Tadej Borovšak
> tadeboro.blogspot.com
> tadeboro gmail com
> tadej borovsak gmail com
>
--
Regards,
~Sid~
I have never met a man so ignorant that i couldn't learn something from him
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]