Article View: comp.sys.next.programmer
Article #292Re: freeing an object--when?
From: mkrogers
Date: Tue, 28 Jul 1992 19:31
Date: Tue, 28 Jul 1992 19:31
25 lines
1754 bytes
1754 bytes
In article <colo.21@odie.ee.wits.ac.za>, colo@odie.ee.wits.ac.za (Illan Colombick) writes: > In article <1992Jul24.180535.18214@MITL.COM> edlau@mitl.com (Ed Lau) writes: > > [stuff deleted] > >>However, since my document object is freed, its window is left without a >>delegate. What to do? > > Surely it does not matter that the window is without a delegate? The Window > is about to close. Unless you have setFreeOnClose: NO (default is YES), so > that the window just disappears from the screen, but remains in existence. > In that case, have windowWillClose check the dontFreeOnClose value to > decide whether or not to free the Document. There might be a problem if the window thinks that the freed object is still its delegate and tries to send it a message. I would guess that after the windowWillClose: method returns the window is done with its delegate. If you want to be on the safe side you could set the window's delegate to nil in windowWillClose:, or use [NXApp delayedFree:self]; in the windowWillClose: method to free your document. The document will be freed just before NXApp tries to get the next event. -mike mkr@cs.amherst.edu
Technical Details
Message-ID:
<1992Jul28.153114.1@amherst.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!darwin.sura.net!wupost!gumby!destroyer!caen!nic.umass.edu!amherst!amherst.edu!mkrogersReferences:
<1992Jul24.180535.18214@MITL.COM> <colo.21@odie.ee.wits.ac.za>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!darwin.sura.net!wupost!gumby!destroyer!caen!nic.umass.edu!amherst!amherst.edu!mkrogers From: mkrogers@amherst.edu Subject: Re: freeing an object--when? Message-ID: <1992Jul28.153114.1@amherst.edu> Lines: 25 Sender: usenet@amhux2.amherst.edu (USENET News System) Nntp-Posting-Host: amh.amherst.edu Organization: Amherst College, Amherst Mass. References: <1992Jul24.180535.18214@MITL.COM> <colo.21@odie.ee.wits.ac.za> Distribution: na Date: Tue, 28 Jul 1992 19:31:14 GMT