Re: glib ref counting problem
- From: Tristan Van Berkom <vantr touchtunes com>
- To: Stefan Kost <kost imn htwk-leipzig de>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: glib ref counting problem
- Date: Mon, 20 Sep 2004 11:38:29 -0400
Stefan Kost wrote:
[...]
unfortunately there are no explicit docs for the behaviour, but in set_property
method receiving a pointer needs to be secured. I will now try to switch to
add_weak_pointer(). One thing I dont get about this function is why I have to
pass the object and then the pointer to my weak pointer. In practice it will
look like:
myobject=object;
g_object_add_weak_pointer(myobject,&myobject);
Btw.: the docs should say, that the method does not initialize the passed
pointer to point to object.
same for
g_object_remove_weak_pointer();
... I am drifting away ;-)
Anyway, I hope that this is the recommended way of doing these things, as I will
update the GObject tutorial soon.
I think I understand your quandry now.
You want the delagate object (BtPattern/BtSetup) to have the
parenting/owning object (BtSong) as a "property". If you want my
"recommendation", IMO this is backwards in principal. You would avoid
alot of trouble if either:
a.) BtSong is created with a sufficient amount of args/properties
to create and own a delagate object where that object doesn't
need to reference BtSong directly.
b.) The delagate object (BtPattern/BtSetup) are created first
and then used to construct a BtSong (i.e. BtPattern/BtSetup
are properties of BtSong). Much in the same way that:
adjustment = g_object_new(GTK_TYPE_ADJUSTMENT, ...);
vscale = g_object_new(GTK_TYPE_VSCALE,
"adjustment", adjustment, ...);
Is that a little closer to the mark ?
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]