swarm-support
[Top][All Lists]
Advanced

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

ProbeDisplay hack


From: Dwight Wilson
Subject: ProbeDisplay hack
Date: Thu, 25 Sep 1997 17:26:19 -0400 (EDT)

There's a problem with probe display - you can't drop one
while a simulation is running or you may get a segmentation
fault.  I've found that this always happens when there is
only one probe display up, and sometimes happens otherwise.

The problem is that Tk seems to be handling the event of
clicking the hide button in the middle of the update of
the probe displays, and if dropping one of the displays
can confuse the Index iterating over the collection of
displays.  The bottom line is that it's only safe to drop
a display if the simulation is stopped.  I don't know if
this is actually documented somewhere, but even if it is,
I can't count on my users remember to pause the simulation to 
dismiss probe displays (for that matter, I can't count on
myself remembering to do so). 

Glen pointed out to me that the problem is that the code
was written to use safe indexes, which unfortunately don't
exist yet, so I've hacked up a temporary solution that can
be used until safe indexes are implemented.  You can grab
the files from:

ftp.cs.jhu.edu:/pub/wilson/swarm/simtool-changes.tar.gz

That file contains the modified files and a diff file
of changes from the 1.0.3 source.  I've only changed the
classes that I'm actually using, there may be other classes
that should be changed as well.  

Basically the fix works as follows.  First, when the hide
button is pressed, the probe display is marked for deletion
rather than dropped immediately.  The update method in
ProbeDisplayManager first updates the displays, then removes
any dropped ones.  Unfortunately, just doing this reverses
the problem.  Probe displays can be dropped while the 
simulation is running but if the simulation is stopped, 
displays aren't actually dropped till you start it again.

So one hack begets another hack.  I added a flag to 
ProbeDisplayManager indicating whether probes should be
dropped immediately or not.  This flag is set in the 
global probeDisplayManager object by the ControlPanel
class.  Note that this won't work if you are doing 
something strange like creating your own ProbeDisplayManager
objects.  

-Dwight



                  ==================================
   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.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]