[comp.sys.mac.programmer] Validating Handles in Pascal

dweisman@umiami.ir.miami.edu (Ordinary Man) (06/29/91)

Hi all. I know this question has been asked before, but I missed it, so here 
goes: If I have a several handles that point to the same relocatable block of 
memory, when I dispose of one, all of those handles point to the same invald 
data. How can I check any one of them to see if the data they point to is still 
valid (i.e. hasn't been disposed of)? I'm using Think Pascal, and to give 
another example, if the handle points to a large record, most (or all) of the 
fields of this record become garbled after you dispose of that memory. What I'm 
doing now is checking the state of one of the fields while the handle is still 
valid and checking again after a period of time to see if the two values match. 
This doesn't seem very trustworthy since there's always a chance the two values 
could be the same before and afterwards. So how's one to do this. I guess I'm 
looking for code (in PASCAL, please!) for: 
	ValidateHandle(hand:Handle):Boolean;
Returns true if valid false if not. Thanks for any help you can offer,

Dan

/-------------------------------------------------------------------------\
|   Dan Weisman -  University of Miami - Florida   |  ||   ||   ||   ||   |
|--------------------------------------------------|  ||   ||   ||\ /||   |
|   INTERNET  -----> dweisman@umiami.IR.Miami.edu  |  ||   ||   || | ||   |
|     BITNET  -----> dweisman@umiami               |  |||||||   || | ||   |
|-------------------------------------------------------------------------|
| "...the fact is- this friction will only be worn by persistance." -RUSH |
\_________________________________________________________________________/