Re: Frustration trying to get NSConnection/NSPort working (feels like it should be simpler ...)
Re: Frustration trying to get NSConnection/NSPort working (feels like it should be simpler ...)
- Subject: Re: Frustration trying to get NSConnection/NSPort working (feels like it should be simpler ...)
- From: Michael Babin <email@hidden>
- Date: Thu, 15 Feb 2007 09:17:42 -0600
On Feb 15, 2007, at 8:21 AM, Michael Babin wrote:
On Feb 14, 2007, at 5:47 PM, Neil Clayton wrote:
The client, after spawning the server and waiting to make sure the
message port exists, gets a reference to the server via:
NSConnection *connection = [NSConnection
connectionWithRegisteredName:portName host:nil];
id proxy = [connection rootProxy];
[proxy setProtocolForProxy:@protocol(ExporterServer)];
return proxy;
It then does the following (on the main thread):
[server setClient:self];
[server startProcessing:[[ExportParameters alloc]
initWithCompressionJob:self]];
You didn't provide all of the code involved (although a very good
summary), so you may be handling this correctly in the missing
part, but are you retaining the connection? Or are you releasing it
(you shouldn't until you're finished using it).
Actually, what I should have said here (to be clearer) is +
[NSConnection connectionWithRegisteredName:host:] may/probably
returns an autoreleased object. If you're holding on to this
reference past the current event loop iteration, you are retaining
it, correct? You're not by any chance releasing it (without a
matching retain), are you?
The stack trace in your debugger looks like some object is being
autoreleased that has already been released (and dealloced). See
<http://developer.apple.com/technotes/tn2004/tn2124.html>,
particularly the part about NSZombieEnabled to help track this
problem down.
--
Michael Babin email@hidden
Order N Development, LLC http://www.orderndev.com/
Goldfish Aquarium for Mac: http://www.lifeglobe.com/product/index.php?
pltid=2&ref=OrderNDev
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden