RE: Window Controller not being released.
RE: Window Controller not being released.
- Subject: RE: Window Controller not being released.
- From: "Josh Ferguson" <email@hidden>
- Date: Wed, 23 Oct 2002 10:52:24 -0500
- Thread-topic: Window Controller not being released.
On the contrary, I believe NSConnection is what is actually giving me my problems. I instantiate a server object in another thread and use NSConnection to communicate between the controller and the server object. Unfortunately It appears that somewhere along the lines, NSConnection doesn't want to let got of the controller (even after I release it). Could it be that there's an additional retain on the NSConnection from the receiving object...when I call [NSConnection connectionWithReceivePort:sendPort] the NSConnection should be autoreleased, should it not? If the NSConnection isn't being properly released, could it be hanging on to an instance of the controller, since the controller is the connection's rootObject? If so, how do I make sure the connection is properly released??
TIA
Josh
-----Original Message-----
From: Dustin Voss [
mailto:email@hidden]
Sent: Tuesday, October 22, 2002 10:52 PM
To: Josh Ferguson
Cc: Cocoa Development List
Subject: Re: Window Controller not being released.
On Tuesday, October 22, 2002, at 09:25 AM, Josh Ferguson wrote:
>
I'm having some troubles with my document based app not releasing the
>
window controller. I've watched the retain and release calls to see
>
what objects are retaining the controller, but unfortunately, I can't
>
match up each call to release with each call to retain to tell which
>
retain isn't getting released. Basically, here's what's happening:
>
>
1.) in the Document's makeWindowController method, I allocate the
>
controller ([[controller alloc] initWithNibName]) which sends a retain
>
request
>
2.) I call [document addWindowController]
>
3.) I manually release the window controller from step 1
>
4.) in the image controller, I set up a connection between two
>
threads, which retains/releases 5/6 times
>
5.) after closing the window, the window sends a few retain/release
>
calls
>
>
and I'm left with a retain count of 1 (and a seriously leaky program).
>
Do I need to manually remove the controller from the document? I've
>
noticed that when the document's dealloc method is called, the
>
windowController array is empty (so I would assume it's automatically
>
getting removed). If I do need to call removeWindowController:, where
>
should I do that? I'm also wary of the NSConnection that I create.
>
Do I need to "close" the connection or anything before I deallocate
>
it? Anybody have any recommendations?
I can tell you that you don't need to worry about NSConnection. That
class is only used during NIB loading, and the AppKit releases them
when done.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.