• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem with changes to NSArrayControllers array causing crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with changes to NSArrayControllers array causing crash


  • Subject: Re: Problem with changes to NSArrayControllers array causing crash
  • From: Grant Christensen <email@hidden>
  • Date: Tue, 19 Jan 2010 12:29:21 +1000

On 19/01/2010, at 12:19 PM, Grant Christensen wrote:

>
> On 19/01/2010, at 11:28 AM, Corbin Dunn wrote:
>
>>> ...
>>> 	20  VATSpy                              0x0000000100004912 -[BBSDataMgr loadDataFile:] + 3851
>>> 	21  Foundation                          0x00007fff8166de99 __NSThread__main__ + 1429
>>> 	22  libSystem.B.dylib                   0x00007fff814c2f8e _pthread_start + 331
>>> 	23  libSystem.B.dylib                   0x00007fff814c2e41 thread_start + 13
>>> )
>>> Code is:
>>> ....			[myTableView reloadData];
>>> 		}
>>
>> NSTableView is not threadsafe - do not call reloadData on a background thread. However, given your particular case it is probably the arraycontroller change that is causing the mutation.
>>
>> corbin
>>
>>
>>
>
> Actually thinking through the flow, it is currently my background thread that is calling the reload.  I have commented that out and it is still crashing, but it is probably a thread safety issue.  I will re-structure so that the background thread signals the main thread its work is done rather than call back into it, which is what it was doing.  Will see how that goes...
>

Yep, chalk another one up to thread safety.  I was kicking off the worker thread to go away and collect all of the data.  When done, it was invoking a selector on the main thread to notify of completion.  I was using :

[callbackMethod performSelector: @selector(loadComplete:) withObject:[NSNumber numberWithBool:returnResult]];

instead of the thread safe version:

[callbackMethod performSelectorOnMainThread:@selector(loadComplete:) withObject:[NSNumber numberWithBool:returnResult] waitUntilDone:NO];

This seems to have fixed it.  Thanks Corbin for pointing me towards the threading issues!

Grant_______________________________________________

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

References: 
 >Problem with changes to NSArrayControllers array causing crash (From: Grant Christensen <email@hidden>)
 >Re: Problem with changes to NSArrayControllers array causing crash (From: Corbin Dunn <email@hidden>)
 >Re: Problem with changes to NSArrayControllers array causing crash (From: Grant Christensen <email@hidden>)

  • Prev by Date: Re: Problem with changes to NSArrayControllers array causing crash
  • Next by Date: Re: Blocking for input during a loop?
  • Previous by thread: Re: Problem with changes to NSArrayControllers array causing crash
  • Next by thread: Unembed Objects
  • Index(es):
    • Date
    • Thread