Skip to content

Help with windowWillClose notification

1 message · Duncan Murdoch

#
I believe I have finally fixed this.  Thanks to Simon who gave the right
solution:  use the windowWillClose notification rather than the dealloc
message.  Thanks also to Neil Tiffin who told me something about how to
implement this, and to Michail Vidiassov who did some nice debugging.

For future reference, here's a summary:

The dealloc method of my object was not called immediately when the
window was closed, so there was a period when rgl thought it had a
window but didn't.  Switching the cleanup code to the windowWillClose
notification fixed this, as I already mentioned.

To add my GLView object as a delegate to receive that notification, I
needed to declare that it supported the NSWindowDelegate protocol when
it was declared, and needed to tell the window to use it as a delegate
via [osxWindow setDelegate:view].

Duncan Murdoch
On 21/08/2014, 8:03 AM, Duncan Murdoch wrote: