g_object_weak_unref and object destruction
- From: Britton <fsblk aurora uaf edu>
- To: <gtk-list gnome org>
- Subject: g_object_weak_unref and object destruction
- Date: Mon, 9 Jun 2003 13:11:41 -0800 (AKDT)
I an object class that I would like to allow users to destroy in the usual
way (with g_object_unref), but since it needs to be mounted on a
GtkDrawingArea, it should also destroy itself when the GtkDrawingArea is
destroyed. I have mostly achieved this by using a weak reference formed
by my object to the GtkDrawingArea it mounts on which when the notify goes
off g_object_unref's my object as well. In addition, I have a
g_object_weak_unref() in my object's dispose method which makes it safe
for users to g_object_unref it and then later destroy the DrawingArea it
was mounted on whithout the weak ref handler going off again and causing
trouble. The problem is that when dispose runs after the GtkDrawingArea
(and, consequently, my object) has been destroyed, I get a warning like
this:
(<unknown>:31281): GLib-GObject-WARNING **: gobject.c:1287: couldn't find
weak ref 0x8054056(0x424d8fe0)
since the weak reference is apparently cleared away when the object it
points to goes, which apparently happens before the dispose method for my
object is called.
I am just wondering what the best gtkish way to deal with this is?
Thanks,
Britton Kerin
__
GNU GPL: "The Source will be with you... always."
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]