home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / programm / 20839 < prev    next >
Encoding:
Internet Message Format  |  1993-01-06  |  1.6 KB

  1. Path: sparky!uunet!olivea!apple!goofy!mumbo.apple.com!gallant.apple.com!apple.com!noah
  2. From: noah@apple.com (Noah Price)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Duplicate Object in Think C?
  5. Message-ID: <noah-060193165521@noah.apple.com>
  6. Date: 7 Jan 93 01:03:21 GMT
  7. References: <white.724729120@sfu.ca> <1992Dec19.002858.299@physc1.byu.edu> <d!q2saf@rpi.edu> <1993Jan5.015329.15824@reed.edu> <noah-050193094549@noah.apple.com> <1993Jan6.084330.7697@netcom.com>
  8. Sender: news@gallant.apple.com
  9. Followup-To: comp.sys.mac.programmer
  10. Organization: (not the opinions of) Apple Computer, Inc.
  11. Lines: 21
  12.  
  13. In article <1993Jan6.084330.7697@netcom.com>, mspace@netcom.com (Brian
  14. Hall) wrote:
  15. > You would want to copy the dat itself in case you end up disposing the
  16. > object.  If you have two copies of an object (that have a handle as
  17. > instance data) then disposing the first object will leave a "dangling
  18. > handle" in the second object - the handle will not be NULL, but it won't
  19. > be pointing to anything you would want it to!
  20.  
  21. If you don't want two copies of the data, though, you could have one object
  22. "own" the data.  For example, CArrayPane does something like this for its
  23. array.  Only the "owner" disposes of the data.
  24.  
  25. Also, using ForgetObject and ForgetHandle helps, since they NULL the handle
  26. rather than leaving it randomly dangling.  Then you can check for a NULL
  27. handle before using it to make sure it's valid.
  28.  
  29. noah
  30.  
  31. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  32. noah@apple.com                                 Macintosh Hardware Design
  33. ...!{sun,decwrl}!apple!noah   (not the opinions of) Apple Computer, Inc.
  34.