Re: gobject weak references



On Tue, 18 Sep 2001, Murray Cumming wrote:

> 1.
> Is this an accurate description of the new gobject weak references
> mechanism?:
> It doesn't actually increase the refcount, so the object might be
> deleted, but you'll know if it does because it will call your callback
> function.

The callback will be called during or before finalization of the object.
It will be called either during finalization time or during the break
references time (eg. GtkObject::destroy).

Resurrection is not allowed inside the weak unref handler.

>
> 2.
> The GWeakNofify callback will have this signature:
> void weaknotify_callback(gpointer data, GObject *where_the_object_was);
> What is the second argument about?

The first argument is the data pointer passed to g_object_weak_ref().  The
second is the pointer to where object resided.  As the name suggests, you
shouldn't expect the pointer to refer to a live object -- you should only
make use of the pointer's value.  The argument is for use by "weak
container" implementations (eg. keeping a list of objects, and removing
them from the list during weak unref).

James.

-- 
Email: james daa com au
WWW:   http://www.daa.com.au/~james/






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