Re: Main Thread Crashing in Multithreaded App
Re: Main Thread Crashing in Multithreaded App
- Subject: Re: Main Thread Crashing in Multithreaded App
- From: Quincey Morris <email@hidden>
- Date: Fri, 6 Aug 2010 20:50:38 -0700
On Aug 6, 2010, at 19:25, Carter R. Harrison wrote:
> The call I'm making to establish the 2nd thread is:
>
> [self performSelectorInBackground:@selector(executeQueryHelper:) withObject:[myMutableDictionary mutableCopy]];
>
> That selector runs a whole lot of stuff that I know performs solidly when it runs by itself in the main thread, and that selector also cretes its own NSAutoReleasePool and then drains it at the end of the method. I opted to make a mutable copy of the dictionary that is passed into the 2nd thread in hopes to reduce any concurrency problems with the shared variable but that didn't seem to make any difference.
It seems very likely that your hopeful attempt to "reduce any concurrency problems" failed.
Since your app crashed trying to dispose of an array (or, specifically, trying to dispose the contents of an array as a result of disposing of the array), the problem probably isn't in the copied mutable dictionary itself. The most likely cause of a crash in such a scenario is that you've forgotten that 'mutableCopy' is a shallow copy of the dictionary, not a deep copy, so you just moved the threading issue from the dictionary to its contents.
That's just a guess, though.
_______________________________________________
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