Yeah sounds like the exact same problem I'm having. The problems aren't 
consistent at all, it just happens once every few thousand strings.

Is there any easy way to execute a portion of code on the main thread without 
going through the mess of delegates and selectors?

Independent Cocoa Developer, Macatomy Software
http://macatomy.com


On 2009-12-22, at 12:06 PM, Chris Backas wrote:

> Hello,
> 
> NSAttributedString has proven to be unsafe in many ways for use on a 
> secondary thread in our own applications. We were trying to do much the same 
> thing, get the size of a string from it. But it turns out (obviously in 
> retrospect) that it needs to use the font/GUI systems to do this, which don't 
> seem to be safe for use on secondary threads.
> 
> My guess is that it's accessing locks in the Layout manager that aren't 
> intended to be accessed from the non-main thread and causing this error. 
> Unless someone else has more insight than I do, you'll have to come up with 
> an alternative way to architect this - we had to do all our string measuring 
> on the main thread. (We were actually getting occasional crashes from doing 
> this on a secondary thread, maybe once every 30K strings or so)
> 
> Hope that helps some,
> Chris Backas

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to