[comp.sys.mac.hypercard] BUG in MPW pascal / afterdark ?

barnett@cc.ic.ac.uk (G.J. Barnett) (02/25/91)

     I have come accross an interesting bug.
The situation is this: 
    Maci IIci, 5 meg if RAM,mpw 3.2b1,pascal 3.1,link 3.2b1.1
    afterdark 2.0t
   I have written an XCMD with two dialogs.If the current OSevent is a
null event then I find out if the dialog needs updating (using
checkupdate). If it does I draw the dialog, and then draw the graphics
on it. This in the case of the second dialog involves ringing the 
'OK' button and a rectangle round a
field. Now comes the interesting bit. When I have started up the second
dialog, which has this drawing rountine hardcoded to its dialog pointer
i.e. I do not pass a variable to the draw procedure but it uses the 
second dialog pointer directly. Sorry about stressing this bit.
    I leave the second dialog on the screen and activate after dark.
When I next exit from after dark it draws a box and ring on BOTH
dialogs. If I tell the procedure not to do anything if the pointer is
to my first dialog it is OK. I use different names, and never equate
them (knowingly). BUT all other controls tthereafter function fine. It
just seems to be the first time after 'after dark' that something gets the
two pointers mixed up.
    If anyone is interestd in the code I'll send it,cos its a bit long
to post as the DITLs would be reqd too, as well as the fairly sizeable
source. I have no idea about what causes it, but it seems to me that if
two pointers can be confused, albeit temprorarily then what hope has the
programmer.
     I would be very interested if anyone has has come accross anything
like this,

    Graham Barnett - barnett@cc.ic.ac.uk