bug in object destroy logic?



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



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