Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!apple!well!oster From: oster@well.sf.ca.us (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: Menu Mangler & ThC 4.0 Nightmare Message-ID: <22214@well.sf.ca.us> Date: 17 Dec 90 07:35:10 GMT References: <1990Dec16.034906.25332@cunixf.cc.columbia.edu> <8640@dog.ee.lbl.gov> Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 38 The menu manager reads the menu resource into memory, then modifies it. If the resoure is purged, the reread, these necessary modifications will not have been done on the new copy, and your program will crash. What you can do is, preserve the state of the menu, when it is good, in another handle, then reset it later. I use a routine like BlockMove, that makes one handle match another. here it is: /* HandleMove - copy all the data from src to dest. */ OSErr HandleMove(src, dest)Handle src, dest;{ LongInt len; OSErr val; #if STRICT if(NIL == src || NIL == dest){ DebugStr((StringPtr) "\pCan't happen in HandleMove"); } #endif val = noErr; if(NIL == dest){ return noErr; } if(NIL == src){ SetHandleSize(dest, 0); return MemError(); } len = GetHandleSize(src); if(len != GetHandleSize(dest)){ SetHandleSize(dest, len); if(noErr != (val = MemError())){ return val; } } BlockMove(*src, *dest, len); return noErr; } -- -- David Phillip Oster - At least the government doesn't make death worse. -- oster@well.sf.ca.us = {backbone}!well!oster