gnustep-dev
[Top][All Lists]
Advanced

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

Re: r27812 - in /libs/gui/trunk: ChangeLog Source/NSBundleAdditions.m


From: Wolfgang Lux
Subject: Re: r27812 - in /libs/gui/trunk: ChangeLog Source/NSBundleAdditions.m
Date: Mon, 22 Mar 2010 15:12:26 +0100

Hi Fred!

Am 19.03.2010 09:20, schrieb Fred Kiefer:
My current position on NIB loading is that no magic should happen there.
Objects created while loading a NIB file should follow the standard
rules. Nothing will be retained except for the top level objects being retained in the top level object array. (And of course instantiated and
visible windows by the normal window display mechanism)
That way anything that is not retained by the owner or specifically
extracted from the top level object array will be freed after loading
the NIB file when no other reference exists.
If we can all agree on this position (and better yet, check that it is
valid on Cocoa), I am going to change our code into this direction.
This may require some extra handling in NSWindowController or NSDocument.

Wolfgang was right, the problem in Bean was not relate to NIB loading at
all. This issue should be resolved (or at least worked around), by the
change I made to NSDocument last night.

The problem with NIB loading was rather that we retained too much. I
tried to resolve this by adding proper releasing of the real object to
many of the NIB loading helper classes and correcting the top level
object handling there as well. This is only the beginning of more clean
up, but should resolve most of the known issues.

Thanks for cleaning this up. I had a look at this, too, and was totally frustrated by the code. Apparently, the author of that code either does not understand or does not care about object ownership.

Could you please give this code a try and load your favourite NIB file?
I haven't tried the results this change has on Gorm, which should also
be tested.

Unfortunately, your change introduces a new bug. In NSBundleAdditions, the owner is now bound to key NSNibOwner, but GSGormLoading (still) expects it to be NSOwner. GSNibLoading also uses NSOwner as primary key but at least uses NSNibOwner as fallback. I also needed a patch to slightly extend the lifetime of a window controller when its window is closed (see patch below); this is similar to your change in NSDocument. Apart from that, the change works fine for me so far (though I haven't tested it much). Interestingly, the nib loading code fixes a space leak that is (still) present in the gorm loader where some views of a window are not released when the window is closed.

Wolfgang

Attachment: NSWindowController.patch
Description: Binary data



reply via email to

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