[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Another bug (and suggested fix) with dropping BLTGraph...
From: |
mcmullin |
Subject: |
Another bug (and suggested fix) with dropping BLTGraph... |
Date: |
Fri, 11 Apr 1997 10:26:04 -0600 (MDT) |
Hmmm...
In a previous message I mentioned that I had a problem
with dropping an EZGraph - namely that the tk frame
didn't get dropped. I eventually "fixed" that by
adding code to the EZGraph drop to drop the unlying
BLTGraph; and adding code to the BLTGraph drop to drop
the tk frame. That *seemed* to work fine at first, but
I have run into another (independent?) problem:
dropping the BLTGraph causes a seg fault and the app
crashes (:-(
The BLTGraph drop looks like this:
-(void) drop {
id index, e;
index = [elementList begin: [self getZone]];
while ((e = [index next])) {
[self destroyElement: e];
}
[index drop];
[globalTkInterp eval: "destroy %s", [parent getWidgetName]];
[super drop];
}
The statement sending the destroy command to
globalTkInterp is the one I added to get rid of the tk
frame. The seg fault is happening *before* that, in
the loop "destroying" the elements of elementList.
Looking at the destroyElement method, I find that it
basically just removes the element from elementList and
then drops it. BUT: since indices are not (yet) safe,
this seems to be a bug: removing an element from
elementList will compromise the validity of index. I
believe this is the cause of the seg fault. (What I
can't really understand is why this hasn't been
encountered by anyone before - unless nobody is ever
dropping BLTGraphs??)
My proposed fix is to change the BLTGraph drop to the
following:
-(void) drop {
while ([elementList getCount] > 0)
[self destroyElement: [elementList getFirst]];
[globalTkInterp eval: "destroy %s", [parent getWidgetName]];
[super drop];
}
This *seems* to work OK in my app and gets rid of the
seg fault I was experiencing. Of course, your mileage
may vary...
Regards,
Barry.
--
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| Barry McMullin, ALife Group, | address@hidden |
| Santa Fe Institute, 1399 Hyde Park Road, | Voice: +1-505-984-8800 |
| Santa Fe, NM 87501, USA. | FAX: +1-505-982-0565 |
| http://www.eeng.dcu.ie/~mcmullin | |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
==================================
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Another bug (and suggested fix) with dropping BLTGraph...,
mcmullin <=