FROM : Alex Reynolds
DATE : Mon Nov 29 18:47:09 2004
On Nov 29, 2004, at 12:19 PM, j o a r wrote:
> -[NSWindow close] and -[NSObject release] are very different methods.
> You need to understand what they do, how and why they differ. Neither
> of them, on their own, triggers the deallocation of anything. If
> you've set the window to be "released on close", calling close will
> trigger a release. If a call to release triggers the window to
> deallocate, the window will in turn release it's view hierarchy, most
> often triggering it to be deallocated in turn.
I think I do understand the difference, at least so far as what is
explained in Apple's online documentation.
Close does trigger a release (because I told it to in
setReleasedWhenClosed) which in turn should dealloc the NSWindow
instance.
>> Here is the entire method I use that handles alternate presses of the
>> "capture" button.
>
> 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.
Is there another method I should call instead, to do this?
> It does, in any case, seem to be the root of the problem - as you
> appear to only create the content view once. If you want to re-use it
> between your calls to this method, you need to add a reference to it
> and retain it, so that you can hold on to it when it's enclosing
> window is deallocated (but why deallocate the window if you plan to
> open it again?).
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.
I appreciate your patient and polite help.
Regards,
Alex
DATE : Mon Nov 29 18:47:09 2004
On Nov 29, 2004, at 12:19 PM, j o a r wrote:
> -[NSWindow close] and -[NSObject release] are very different methods.
> You need to understand what they do, how and why they differ. Neither
> of them, on their own, triggers the deallocation of anything. If
> you've set the window to be "released on close", calling close will
> trigger a release. If a call to release triggers the window to
> deallocate, the window will in turn release it's view hierarchy, most
> often triggering it to be deallocated in turn.
I think I do understand the difference, at least so far as what is
explained in Apple's online documentation.
Close does trigger a release (because I told it to in
setReleasedWhenClosed) which in turn should dealloc the NSWindow
instance.
>> Here is the entire method I use that handles alternate presses of the
>> "capture" button.
>
> 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.
Is there another method I should call instead, to do this?
> It does, in any case, seem to be the root of the problem - as you
> appear to only create the content view once. If you want to re-use it
> between your calls to this method, you need to add a reference to it
> and retain it, so that you can hold on to it when it's enclosing
> window is deallocated (but why deallocate the window if you plan to
> open it again?).
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.
I appreciate your patient and polite help.
Regards,
Alex
| Related mails | Author | Date |
|---|---|---|
| Alex Reynolds | Nov 29, 10:07 | |
| j o a r | Nov 29, 10:24 | |
| Alex Reynolds | Nov 29, 10:32 | |
| j o a r | Nov 29, 10:42 | |
| Lorenzo | Nov 29, 12:06 | |
| Alex Reynolds | Nov 29, 18:02 | |
| j o a r | Nov 29, 18:19 | |
| Alex Reynolds | Nov 29, 18:47 | |
| j o a r | Nov 29, 19:01 | |
| Alex Reynolds | Nov 29, 19:53 | |
| j o a r | Nov 29, 20:23 | |
| Alex Reynolds | Nov 29, 20:26 | |
| j o a r | Nov 29, 20:35 | |
| M. Uli Kusterer | Nov 29, 20:42 |






Cocoa mail archive

