[617] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] bug in object destroy logic?

daemon@ATHENA.MIT.EDU (Raph Levien)
Fri Aug 1 14:19:33 1997

Date: Fri, 1 Aug 1997 11:16:24 -0700 (PDT)
From: Raph Levien <raph@acm.org>
To: gtk-list@redhat.com
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com

I think there's a bug in the object destroy logic. Consider a hierarchy 
of objects, A -> B -> C. Let's say that A and C define a destroy method in 
the class, but B does not. Further, let's say that the destroy methods of 
A and C follow the idiomatic usage of calling the parent's destroy method 
at the end.

I think what happens is this: since B did not set a destroy method, the 
destroy method for A gets copied in. Thus, C's destroy method will call 
A's (standing in for B's), which in turn will call A's. Thus, A's destroy 
method ends up getting called twice, which could lead to lots of havoc.

I think the easiest workaround is just to ensure that every object which 
might get subclassed has an object destroy method defined.

It's also possible I just don't understand the mechanism.

Raph

--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post