Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: My problems with AddResource Message-ID: <7018@hoptoad.uucp> Date: 16 Apr 89 19:18:10 GMT References: <81471DN5@PSUVM> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 21 In article <81471DN5@PSUVM> DN5@PSUVM.BITNET writes: >I am trying to add a resource to a HyperCard stack. I have done this >successfully before, but I can't get it to work now. I copied the code >from my working version (which still works), but very odd things happen. > >My XCMD does the following: > > ReleaseResource (Handle (aMyRecHandle)); > DisposHandle (Handle (aMyRecHandle)); Don't call DisposHandle after ReleaseResource. ReleaseResource has already done it. Disposing of a handle twice is a good way to corrupt the heap. You were just lucky that it worked before. In fact, I wouldn't even call ReleaseResource. An unlocked, purgeable handle is not too likely to cause memory problems. Just add it; from that point on, the Resource Manager can take care of it. -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim "There's a real world out there, with real people. Go out and play there for a while and give the Usenet sandbox a rest. It will lower your stress levels and make the world a happier place for us all." -- Gene Spafford