home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / mac / programm / 18642 < prev    next >
Encoding:
Text File  |  1992-11-19  |  2.1 KB  |  51 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!nih-csl.dcrt.nih.gov!FAXCSL!FIXER
  3. From: fixer@faxcsl.dcrt.nih.gov (Chris Spiral Catfish Tate)
  4. Subject: Re: Problem isolated but not understood (THINK Pascal standalone crash)
  5. Message-ID: <1992Nov19.130202.9832@alw.nih.gov>
  6. Sender: postman@alw.nih.gov (AMDS Postmaster)
  7. Reply-To: fixer@faxcsl.dcrt.nih.gov
  8. Organization: Computer Systems Laboratory, DCRT, NIH
  9. References: <Bxy3q0.231@news.udel.edu>
  10. Date: Thu, 19 Nov 1992 13:02:02 GMT
  11. Lines: 38
  12.  
  13. In article <Bxy3q0.231@news.udel.edu>, kurisuto@chopin.udel.edu
  14. (Sean J. Crist) writes:
  15. >
  16. >SetHandleSize(Handle(DestinationHandle), GetHandleSize
  17. >    (Handle(SourceHandle))); {Make the two handles the same size}
  18. >BlockMove(Pointer(SourceHandle^), Pointer(DestinationHandle^),
  19. >    GetHandleSize(Handle(SourceHandle))); {Copy the contents 
  20. >    of one handle into the other}
  21.  
  22. This looks suspicious, because there's a Toolbox call within the parameter
  23. list to the BlockMove() procedure.  Does anyone know whether GetHandleSize()
  24. moves memory?  It seems unlikely, but you never know.  You could try
  25.  
  26.    (* sourceSize is a LONGINT *)
  27.  
  28.    sourceSize := GetHandleSize(Handle(SourceHandle));
  29.    BlockMove(Pointer(SourceHandle^), Pointer(DestinationHandle^),
  30.       sourceSize);
  31.  
  32. and see if that helps.
  33.  
  34. Alternatively, you could just use the HandToHand() OS Utility call, thus:
  35.  
  36.    (* DO NOT allocate DestinationHandle previously! *)
  37.  
  38.    DestinationHandle := SourceHandle;
  39.    err = HandToHand(Handle(DestinationHandle));
  40.  
  41. This allocates a new handle, copies the contents of the argument block into
  42. it, and sets the argument to be equal to it, i.e. causes DestinationHandle
  43. to point to a new copy of what it *used* to point to.  You have to remember
  44. seperately the original handle.  See Inside Macintosh II-374 for full details.
  45.  
  46. ------------------------------------------------------------------------------
  47. Christopher Tate             | The Leadfoot Collection, Continued:
  48. Management System Designers  |     * Heavy Fuel (Dire Straits)
  49.                              |     * Last Scene in September (Preston Reed)
  50. fixer@faxcsl.dcrt.nih.gov    | Because driving fast is a cathartic experience.
  51.