Re: NSWindow alloc/dealloc problems
Re: NSWindow alloc/dealloc problems
- Subject: Re: NSWindow alloc/dealloc problems
- From: j o a r <email@hidden>
- Date: Mon, 29 Nov 2004 19:01:34 +0100
On 2004-11-29, at 18.47, Alex Reynolds wrote:
Close does trigger a release (because I told it to in
setReleasedWhenClosed) which in turn should dealloc the NSWindow
instance.
Agreed - IFF no one else is retaining the window.
I'm not quite sure that I understand why you assign the content view
to the window like that.
How else do I assign a content view to a window? I'm only reading
Apple's documentation, now.
Perhaps I'm just not understanding you (when you create a new window it
comes with a content view already in place). One valid reason for doing
what you're doing is of course if the NSPanel instance that you're
creating has some special content view that you want to use instead of
the content view that's already in your "targetWindow"?
If I change the target display (in a multiple monitor setup) or change
the target display mode (resolution of a selected monitor), the
content view doesn't change (and shouldn't need releasing) but the
NSWindow object instance does need to be remade, depending on the
state of the application when the capture button is pressed.
Is it not enough to simply resize and / or reposition it (-[NSWindow
setFrame:display:])?
But never mind that - To get somewhere with your crashes I suggest that
you create an instance variable to your content view and retain it:
targetDisplayCino = [[NSPanel alloc] init];
targetDisplayCinoContentView = [[targetDisplayCino contentView]
retain];
And later in dealloc:
[targetDisplayCinoContentView release];
That should prevent it from being deallocated when you swap it between
windows.
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden