Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!crackers!m2c!umvlsi!umaecs!amh!djvelleman From: djvelleman@amherst.bitnet Newsgroups: comp.sys.mac.programmer Subject: Invalid port in event loop Message-ID: <10804.272420f5@amherst.bitnet> Date: 23 Oct 90 10:52:37 GMT Lines: 20 Last week I posted a question about calling SystemTask or GetNextEvent with thePort not set to a legal GrafPort. The more I think about this, the more concerned I am about potential problems. Suppose I close a window and then call DisposeWindow to dispose of the window record. If that window was the current grafport, won't thePort now be invalid? If I return to the main event loop without doing something about this, will my program crash? I know many people don't dispose of window records when they close windows, but surely lots of people call DisposDialog when they're done with a dialog. Won't this cause the same problem? Perhaps my diagnosis of my bug was wrong, but I don't think so. At any rate, setting the port to a valid grafport before going to the main event loop stopped the program from crashing. 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? Dan Velleman Math Dept. Amherst College