Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site lzaz.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!lzaz!mkg From: mkg@lzaz.UUCP (Marsh Gosnell) Newsgroups: net.micro.mac Subject: Bad Megamax bug if you use modaldialog in a DA Message-ID: <494@lzaz.UUCP> Date: Tue, 4-Feb-86 14:15:24 EST Article-I.D.: lzaz.494 Posted: Tue Feb 4 14:15:24 1986 Date-Received: Tue, 11-Feb-86 06:45:14 EST Organization: AT&T Information Systems, Lincroft Lines: 26 I have uncovered a rather nasty bug in Megamax (version 2.1b) that will occasionally cause crashes. The bug exists in any DA that has dNeedTime set and uses modaldialog (the Standard File Manager uses modaldialog). The bug is causd by the way Megamax manages the block of heap storage allocated to the global/string storage. Megamax allocates the block on the the first open of the DA, places the handle in dctlstorage, and also in A4. All user code references the globals and strings relative to A4. The glue routines for the control, close, etc. entries supplied by Megamax lock the block upon entry and unlock it when it exits. The problem with using modaldialog is that it calls SystemEvent which in turn periodically calls the control routine of each DA that have the dNeedTime bit set. If your DA has that bit set, your control routine will be called WHILE you are inside modaldialog. Where you get into trouble is that when this call to the control routine exits, your global block is unlocked while you are still inside modaldialog!! If the heap gets shuffled before you return, you are in BIG trouble. A4 still points to the old location of the block when it has been moved to a new location in the heap and you get "interesting" results (usually address error traps). The fix I'm suggesting to Megamax (thanks to Steve Brecher) is to check if the block is locked when you enter the control routine. If it is, don't unlock it when you're finished. In the mean time, I've removed the dNeedTime bit from my DA's flags. Marsh Gosnell ihnp4!lzma!mkg