Re: Chaining of dispose and finalize
- From: Jeff Franks <jcf tpg com au>
- To: Russell Shaw <rjshaw netspace net au>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Chaining of dispose and finalize
- Date: Fri, 03 Sep 2004 20:47:10 +0000
Russell Shaw wrote:
Hi,
I made an object (View) derived from GObject.
I overide the parent dispose and finalize pointers:
static void
view_class_init(ViewClass *klass)
{
parent_class=g_type_class_peek_parent(klass); // static
GObjectClass *gobject_class=G_OBJECT_CLASS(klass);
ViewClass *view_class=VIEW_CLASS(klass);
gobject_class->dispose=view_dispose;
gobject_class->finalize=view_finalize;
...
}
This means the next two functions should call g_object_real_dispose()
and g_object_finalize():
static void
view_dispose(View *view)
{
if(view->dispose_has_run)
return;
view->dispose_has_run=TRUE;
}
static void
view_finalize(View *view)
{
}
But how do i do that when g_object_real_dispose() and g_object_finalize()
are both declared static in gobject.c ?
With lines like these to call the parent (i.e. GObject) functions in
view_dispose():
G_OBJECT_CLASS (parent_class)->dispose (view);
and in view_finalize():
G_OBJECT_CLASS (parent_class)->finialize (view);
Jeff.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]