[Xotcl] more problems with destroy

Kristoffer Lawson setok@fishpool.com
Tue, 23 Jan 2001 00:59:32 +0200 (EET)


We're still getting the odd problem with destroy, even with an update to
0.83. The situation is the following:

An Event object exists in the system.
An event is sent to this object (and the 'event' method of this object is
called).
The event method calls another method in another object which is
set to be the event callback.
As a result of this call the object gets destroyed. Or rather it destroys
another object (its parent), which in turn destroys the Event object.

According to the "destroy" logic, this should work fine. And in fact it
does.. for a while. At some point during the execution of the
callback I get this message:

destroy failed (probably wrong # args?) or object called after physical
destroy
    while executing "$ob event [$cmd getAttrs]"
    (procedure "newData" line 24)
    ::eniak::EniakServer0 ::eniak::EniakServer->newData
    invoked from within "
::eniak::EniakServer0 newData"

This comes at some point during the execution of the event method (which,
as mentioned, is a method of the Event object). This seems to be very
difficult to replicate as the simple cases I've built wont do the trick.
To give you some idea why it's so difficult I'll mention that in my first
case it crashed (as above) just after (successfully) creating a
SelectionList object in my callback. To see if it was the amount of
created objects that mattered, I instantiated a Text object before this.
It still crashed with the SelectionList. The natural assumption then is
that there might be something funny with the SelectionList. Just to be
certain, I created a Button between the Text and SelectionList. Now it
crashed immediately after the Text object -- before it even reached the
Button or SelectionList in the code! Removing the Button made it crash
after the SelectionList again...

This would lead me to believe that there may just be a small possibility
of some kind of memory overwriting taking place or something else very
funny. I'm really sorry to be this vague. Maybe I missed something after
all, but I've been debugging this all day and I just can't find anything
suspicious myself and am running so tight with time I can't really spend
much on this -- especially as it's rather random. The problem is also that
it's not very obvious how to go round this particular case without
seriously altering the structure of the code.

If there is anything that can cause this I'd really appreciate some
tips. Or if there is a bug somewhere in there a patch would be
splendid. As we've already missed one deadline I'd appreciate any help I
can get. I can send the code that causes the problem, although I'm not
sure how much it will help as there's quite a bit of it. I might be able
to cut some irrelevant parts off, though...

Meanwhile I'll sleep over it and see if I solve it in my dreams.

         -     ---------- = = ---------//--+
         |    /     Kristoffer Lawson      |  www.fishpool.fi|.com
         +-> |    setok@fishpool.com       |  - - --+------
             |-- Fishpool Creations Ltd - /         |
             +-------- = - - - = ---------      /~setok/