[Openmcl-devel] Three questions

Ron Garret ron at awun.net
Fri Feb 8 22:49:30 PST 2008


On Feb 8, 2008, at 2:34 PM, R. Matthew Emerson wrote:

>
> On Feb 8, 2008, at 4:34 PM, Ron Garret wrote:
>
>> 1.  Is there a way to tell when a window has been closed?
>
> I only know of the usual Cocoa/Objective-C ways:
>  * register to receive NSWindowWillCloseNotification
>  * implement windowWillClose: in the window's delegate

So I got this to work by creating a container class to encapsulate an  
NSWindow, and creating a delegate that sets the NSWindow slot in the  
container to nil when windowWillClose: is called.  Still, it seems  
very odd that one should have to jump through this kind of hoop.  I  
would expect naively written mac apps to be crashing regularly trying  
to perform operations on closed NSWindows, and yet they don't.  Is  
this just one of those things that all Cocoa programmers just know?

rg




More information about the Openmcl-devel mailing list