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