Path: utzoo!attcan!uunet!wuarchive!zaphod.mps.ohio-state.edu!ncar!gatech!prism!sun13!gw.scri.fsu.edu!pepke From: pepke@gw.scri.fsu.edu (Eric Pepke) Newsgroups: comp.sys.mac.programmer Subject: Re: Invalid port in event loop Message-ID: <1280@sun13.scri.fsu.edu> Date: 26 Oct 90 14:55:11 GMT References: <10804.272420f5@amherst.bitnet> Sender: news@sun13.scri.fsu.edu Organization: Florida State University, but I don't speak for them Lines: 34 In article <10804.272420f5@amherst.bitnet> djvelleman@amherst.bitnet writes: > What's the official policy on setting > thePort before calling SystemTask or GetNextEvent? What's the official > policy on disposing of window records? Has anyone else had a problem with > this? I don't know what the "official" policy on setting the current GrafPort is, but one should set it to a known good port once every time through the event loop, EVEN IF one's program is otherwise perfectly consistent with GrafPorts. The reason for this is that you don't know what desk accessories are doing behing your back. (Yes, I know that they are by default not loaded in the same partition under MultiFinder, but somebody will do it.) Now, some desk accessories have bugs which cause them to dispose of windows without setting the current GrafPort correctly. Some have bugs which cause them to call one of the QuickDraw routines that require a valid current GrafPort without setting it first. Either will work fine with most programs, but when somebody runs both of these desk accessories under your program, KABOOM! You can be sure that the resulting shrapnel will be blamed on your program, so play it safe. Eric Pepke INTERNET: pepke@gw.scri.fsu.edu Supercomputer Computations Research Institute MFENET: pepke@fsu Florida State University SPAN: scri::pepke Tallahassee, FL 32306-4052 BITNET: pepke@fsu Disclaimer: My employers seldom even LISTEN to my opinions. Meta-disclaimer: Any society that needs disclaimers has too many lawyers.