[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSTextView memory leak
From: |
Alexander Malmberg |
Subject: |
Re: NSTextView memory leak |
Date: |
Sun, 20 Oct 2002 19:11:25 +0200 |
Caba Conti wrote:
>
> The following code is from NSTextView's dealloc method:
> (CVS version from october 19th)
>
> -------------------
> /* Balance the RELEASE we sent to us to break the retain cycle
> in initWithFrame: or initWithCoder: (otherwise releasing the
> _textStorage will make our retain count go below zero ;-) */
> RETAIN (self);
>
> /* This releases all the text objects (us included) in
> * fall. */
> DESTROY (_textStorage);
>
> /* When the rest of the text network is released, we'll be
> * released again and be deallocated for real. That will
> * likely happen during the DESTROY of the _textStorage, or
> * later if parts of the text network are maybe retained
> * elsewhere (in autorelease pools etc) for slightly longer.
> */
> return;
> -------------------
I had a quick look at it, and it seems like the semantic changes in
NSDecrementExtraRefCountWasZero() (and thus -release/-dealloc;
2002-06-01) broke this. If the new behavior is correct, the
RETAIN(self); can simply be removed.
- Alexander Malmberg