Re: What could cause a fast enumeration mutation error in updating tracking areas?
Re: What could cause a fast enumeration mutation error in updating tracking areas?
- Subject: Re: What could cause a fast enumeration mutation error in updating tracking areas?
- From: Gideon King <email@hidden>
- Date: Sat, 30 Jul 2011 08:44:35 +1000
Thanks for the suggestion Raleigh, but no, there are no other threads involved in any of the tracking area code, and looking at the crash report in more detail, it shows that the array that is being mutated has 27 items in it - the views I create only have one or two tracking areas that I add. I do have quite a few tracking rects but can't find a place where I would have 27 of them on a view.
I went through all my code looking for where I was using tooltips, and I found one suspicious looking bit of code, where in certain circumstances my drawRect: could call a method which would lead to removeAllTooltips and addToolTipRect:owner:userData: to be called. Seeing as this looks like the most likely cause (assuming the implementation uses tracking areas behind the scenes), and it's probably not a good thing to be doing during drawRect, I'll shift the code to be called outside drawRect: and see if the error goes away.
There are a few other places where tooltip rects could be updated and there could be 27 of them, but although in some cases the initiating caller may have come from another thread, it always calls back to the main thread for this operation, so I'm pretty sure we're OK there.
I also thought that cursor rects may be using tracking areas behind the scenes, so checked them too, but they are all done through the resetCursorRects mechanism, so presumably that would only be called when it is safe to do so.
So maybe the drawRect: one was it - I guess I'll know in a few days when I roll it out to my testers and see if I get the error again.
Regards
Gideon
On 30/07/2011, at 2:14 AM, Raleigh Ledet wrote:
> Do you have another thread that is doing something with tracking areas?
>
> -raleigh
>
> On Jul 28, 2011, at 11:33 PM, Gideon King wrote:
>
>> Hi, I have a problem where a few users of my program are getting the following exception:
>>
>> 0 CoreFoundation 0x00007fff862df7b4 __exceptionPreprocess + 180
>> 1 libobjc.A.dylib 0x00007fff84b0ff03 objc_exception_throw + 45
>> 2 CoreFoundation 0x00007fff863375bf __NSFastEnumerationMutationHandler + 303
>> 3 AppKit 0x00007fff83ec8660 -[NSView trackingAreas] + 271
>> 4 AppKit 0x00007fff83f1d025 -[NSView(NSInternal) _updateTrackingAreas] + 249
>>
>>
>> But all the tracking areas I am adding are done in the initialization of the views or awakeFromNib, and not updated after that. I do use tracking rects and tooltip rects, and wonder whether they use tracking areas behind the scenes, and whether there are specific places in the code I need to avoid changing them.
>>
>> I haven't been able to reproduce the problem here, so can't catch it in the act so far.
>>
>> Any suggestions as to what to look for?
>>
>> Thanks
>>
>> Gideon
>>
_______________________________________________
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