Re: needing help w/ asynchronous message problem, using YAMessageQueue
Re: needing help w/ asynchronous message problem, using YAMessageQueue
- Subject: Re: needing help w/ asynchronous message problem, using YAMessageQueue
- From: Ken Thomases <email@hidden>
- Date: Sat, 16 Jan 2010 08:48:28 -0600
On Jan 15, 2010, at 10:04 PM, Shane wrote:
> I have a thread already where I use asynchronous messages to
> communicate (using YAMessageQueue). My main application thread sends
> messages to a task thread similar to the below line, but for some
> reason, when I'm sending from my task thread to the main application
> thread, I'm getting the following error (I do have other messages from
> my task thread to the main app thread that do work, just not this
> one).
>
> 2010-01-15 21:28:50.483 myApp[16330:420b] YAMessageQueue caught "***
> -[NSCFArray insertObject:atIndex:]: attempt to insert nil" when
> invoking updateLoadedNetworkConfiguration:
>
> [[clientQueue proxyForTarget:controller] updateLoadedNetworkConfiguration:nc];
>
> I think it may have something to do w/ the class that I'm trying to
> pass to it (nc) which is my NetworkConfiguration class.
> There's a callback in the YAMessageQueue class where I see where the
> error is coming from, but don't quite understand what's going on or
> still, why this is happening.
>
> static void
> rlsCallBack(void *info)
> {
> YAMessageQueue *queue = [(YAMessageQueue*)info retain];
> NSInvocation *invoc;
> do {
> invoc = nil;
> NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
> NS_DURING
> invoc = [queue dequeueInvocation];
> if (invoc)
> [invoc invoke];
> NS_HANDLER
> NSLog(@"YAMessageQueue caught \"%@\" when invoking %s",
> localException, invoc ? (const char*)[invoc selector] :
> "dequeueInvocation");
> NS_ENDHANDLER
> [pool release];
> } while (invoc!=nil);
> [queue release];
> }
I've used YAMessageQueue before. The issue you're seeing is not directly related to it, though.
YAMessageQueue has conveyed the invocation of -updateLoadedNetworkConfiguration: to the destination thread and invoked it there. It is something within -updateLoadedNetworkConfiguration: which is throwing the original exception because there's been an attempt to insert a nil into an array. YAMessageQueue is catching the exception and logging it, that's all.
If you can reproduce this issue, then you should do so while running your app in the debugger. Tell Xcode to stop on Objective-C exceptions and you'll see the point of the original exception and can explore the backtrace to figure out what's going on.
Good luck,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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