home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 21939 < prev    next >
Encoding:
Text File  |  1993-01-22  |  1.7 KB  |  36 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!nigel.msen.com!fmsrl7!destroyer!sol.ctr.columbia.edu!fnal.fnal.gov!gwatts
  3. From: gwatts@fnalo.fnal.gov
  4. Subject: Verifying valid handles, how to?
  5. Sender: nobody@ctr.columbia.edu
  6. Organization: Fermi National Accelerator Lab
  7. Date: Fri, 22 Jan 1993 07:55:20 GMT
  8. Message-ID: <1993Jan22.015520.1@fnalo.fnal.gov>
  9. Lines: 23
  10. X-Posted-From: fnalo.fnal.gov
  11. NNTP-Posting-Host: sol.ctr.columbia.edu
  12.  
  13. Hi all,
  14.   The first part is an amusing story.  The second request for help is aimed
  15. at anyone who is good at the memory manager. :)  Everyone, right? :)
  16.   I spent about 4 hours tracking down a but in my Think C 5.0.3 program
  17. yesterday.  It was crazy.  My color table kept getting corrupted.  I would
  18. never bomb in the same place.  Sometimes the "rb" command in MacsBug wouldn't
  19. even work!  I had icons explode into little dots.
  20.   Turns out (sheepish grin) I was deleteing an object twice. :)
  21.   At any rate, I was thinking.  I've got only indirect objects in my project.
  22. This means every object is a handle, right?  Well, why not, in the debug
  23. version of the message dispatcher (oopDebug library) put a little code that
  24. will check the object is infact allocated as a handle?
  25.   I checked out the routine in msg.c (in the oops Libraries folder), and
  26. the handle is stored in register a1.  I don't know, however, how to check
  27. if it is a valid handle without causing an error (bus or otherwise) of
  28. somesort.  Especially if it is a random number!  Anyone know?  Is there
  29. some memory manager routine, given a suspected handle, will tell me this?
  30.   By the way -- I do zero all objects after I delete them.  This case was
  31. a little more subtle than that (so don't yell at me :)).
  32.  
  33.     Cheers,
  34.         Gordon.
  35.  
  36.