discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView retain cycle problem


From: Alexander Malmberg
Subject: NSTextView retain cycle problem
Date: Mon, 18 Feb 2002 16:22:16 +0100

Hi,

I've been testing a program of mine (a newsreader; hopefully I'll be
able to release an early version soon) with double-release checking
enabled, and have encountered some problems with an NSTextView that's
being created as a default field editor for a window. Since the
NSTextView owns the text network it will be released from it's dealloc
method and its retain count will drop to -1. This causes the
double-release checking to complain (and it seems like it could also
trigger an exception in one version of NSDecrementExtraRefCountWasZero).

Since the NSTextView -dealloc method already guards against recursive
dealloc (which will never happen since NSDecrementExtraRefCountWasZero
checks ==0, not <=0), it seems to me that adding 'RETAIN(self);' before
'RELEASE(_textStorage);' would fix this problem.

(For some reason, this does not happen every time I close a window after
editing a text field, but I'm not sure why.)

- Alexander Malmberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]