Re: Chaining of dispose and finalize



Russell Shaw wrote:
[...]
Obviously something very basic i'm missing here;)


Maybe i should record the parent functions in static pointers
before overiding them:
[...]
  G_OBJECT_CLASS(parent_class)->dispose=myobject_dispose;
  G_OBJECT_CLASS(parent_class)->finalize=myobject_finalize;

That is really backwards :-O

In your class init, you override dispose on YOUR COPY of the GObjectClass
struct with myobject_dispose.

then you obtain a pointer to the IN TACT / READ ONLY copy of the GObjectClass
struct with g_type_class_peek_parent.

then in your dispose implementation which is called on YOUR COPY of the
GObjectClass, you chain up to the IN TACT function which still resides
in the READ ONLY `parent_class' pointer.

Does that clarify things ?

Cheers,
                            -Tristan







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