Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site utcs.uucp Path: utzoo!utcs!wjr From: wjr@utcs.uucp (William Rucklidge) Newsgroups: net.micro.amiga Subject: Re: FreeDiskObject Message-ID: <1163@utcs.uucp> Date: Wed, 19-Mar-86 18:07:51 EST Article-I.D.: utcs.1163 Posted: Wed Mar 19 18:07:51 1986 Date-Received: Wed, 19-Mar-86 18:23:21 EST References: <1538@gitpyr.UUCP> Reply-To: wjr@utcs.UUCP (William Rucklidge) Organization: University of Toronto Computing Services, general purpose UNIX Lines: 50 Summary: In article <1538@gitpyr.UUCP> wutka@gitpyr.UUCP (Mark Wutka) writes: > I don't know if anyone else has had trouble getting Amiga Hack to work > but I have...actually, the only problem I have had is in the save command. > When I tried to save a game it hung...I traced the problem all the way > down to the FreeDiskObject call in makeicon. Is there something wrong > with this routine ?? > Mark Wutka > ...!{akgua,allegra,amd,hplabs,ihnp4,masscomp,ut-ngp}!gatech!gitpyr!wutka > ...!{rlgvax,sb1,uf-cgrl,unmvax,ut-sally}!gatech!gitpyr!wutka Well, there is nothing wrong with this routine, but there are a couple of problems with the code around it: the routine is makeicon, in hack.icon.c (in part 10 of the posting). The original code reads: if ( (object = GetDiskObject(source)) == NULL) myprintf("Cannot get source icon - err #%d\n", IoErr() ); object->do_CurrentX = NO_ICON_POSITION; object->do_CurrentY = NO_ICON_POSITION; if ( (object = PutDiskObject( name, object )) == NULL) myprintf("Cannot create save icon - err #%d\n", IoErr() ); FreeDiskObject(object); which I have modified to read: if ( (object = GetDiskObject(source)) == NULL) { myprintf("Cannot get source icon - err #%d\n", IoErr() ); } else { object->do_CurrentX = NO_ICON_POSITION; object->do_CurrentY = NO_ICON_POSITION; if ( (PutDiskObject( name, object )) == NULL) myprintf("Cannot create save icon - err #%d\n", IoErr() ); FreeDiskObject(object); } which seems to work fine, whether the icons exist or not. The problem is that the routine PutDiskObject was returning a status, which was overwriting the pointer to the object. Later, freeing that pointer caused the crash. My copy of hack still has a problem, though - attempting to wield bare hands causes a Task Held error... I haven't been able to figure this one out yet. Oh well... -- William Rucklidge University of Toronto Computing Services {decvax,ihnp4,utcsri,{allegra,linus}!utzoo}!utcs!wjr GISO - Garbage In, Serendipity Out. This message brought to you with the aid of the Poslfit Committee.