Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Dialog problems Keywords: Dialog Message-ID: <7534@hoptoad.uucp> Date: 4 Jun 89 22:20:59 GMT References: <1426@ns.network.com> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 37 It's pretty clear that all the code posted has been correct. I'd like to mention a few debugging techniques that can be useful in this kind of situation: (1) Brute force. Cut out small sections of code that are not absolutely neccessary to correct execution of the software (e.g., number processing) and then try to replicate the problem. Delete only one small section each time, or cut out a large section until you find the area of the problem, then narrow it down from there. (2) Check for heap corruption using MacsBug. Break on ModalDialog and check at that time, the second time around; also, checking after the first CloseDialog would make sense. The command is "HC". If the heap is corrupted, using the ATHC command will locate the place in short order. (3) Make a tiny application consisting solely of initializing the managers and then going into your dialog. Be sure to use exactly the same code and resources. If you can run it more than once in the tiny application (Just stick it in a loop) then your problem is actually in another section of code and it only happens to blow away that dialog through coincidence. (4) Use RezDet to check the resource fork of your application. (5) Step into the ROM call ModalDialog to find out exactly where the crash happens. This can be painful but may be neccessary. (6) Run in Heap Scramble mode and see if anything breaks. If so, go to your code and figure out why. Good luck! -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim "There's a real world out there, with real people. Go out and play there for a while and give the Usenet sandbox a rest. It will lower your stress levels and make the world a happier place for us all." -- Gene Spafford