Important: The information in this document is obsolete and should not be used for new development.
ClosePort
TheClosePortprocedure closes a basic graphics port. The Window Manager calls this procedure when you close or dispose of a window, and theDisposeGWorldprocedure calls it when you dispose of an offscreen graphics world containing a basic graphics port.
PROCEDURE ClosePort (port: GrafPtr);
port- A pointer to a
GrafPortrecord.DESCRIPTION
TheClosePortprocedure releases the memory occupied by the given graphics port'svisRgnandclipRgnfields. When you're completely through with a basic graphics port, you can use this procedure and then dispose of the graphics port with the Memory Manager procedureDisposePtr(if it was allocated withNewPtr). When you call theDisposeWindowprocedure to close or dispose of a window, it callsClosePortandDisposePtrfor you. When you use theCloseWindowprocedure, it callsClosePort, but you must callDisposePtr.SPECIAL CONSIDERATIONS
IfClosePortisn't called before a basic graphics port is disposed of, the memory used by the visible region and the clipping region will be unrecoverable.The
ClosePortprocedure may move or purge memory blocks in the application heap. Your application should not call this procedure at interrupt time.SEE ALSO
TheCloseCPortprocedure (described in the chapter "Color QuickDraw") closes a color graphics port. TheDisposeGWorldprocedure is described in the chapter "Offscreen Graphics Worlds" in this book. TheDisposeWindowandCloseWindowprocedures are described in the chapter "Window Manager" in Inside Macintosh: Macintosh Toolbox Essentials. TheDisposePtrprocedure is described in the chapter "Memory Manager" in Inside Macintosh: Memory.