On 18 May 2008, at 16:51, Fred Kiefer wrote:
Last week I tried to resolve a circular refernce problem between
NSWindow and NSGraphicsContext.
The source of the problem is that when an NSWindow gets displayed it
generates an NSGraphicsContext (or rather a subclass) which will
then manage all the actual drawing. The window retain the context
and the context has an info dictionary which includes the window.
That way we already start off with a circular reference. To break
this I released the window once, to adjust the retain count.
Well ... my immediate thought is that the window should not be stored
in the info dictionary.
When a context is created, the contents of the attributes dictionary
should be extracted and stored in ivars and either retained or not
retained as appropriate for each attribute. When the -attributes
method is called, a new dictionary should be generated from the
attributes stored in ivars. Then the retain cycle goes away, and you
can use a private method to allow a window to zero the ivar when it is
deallocating itsself (if necessary: it isn't necessary unless the
graphics context can somehow be used after the window is deallocated).
_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev