Re: NSRecursiveLock problems
Re: NSRecursiveLock problems
- Subject: Re: NSRecursiveLock problems
- From: Chris Backas <email@hidden>
- Date: Tue, 22 Dec 2009 14:06:41 -0500
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
On Dec 22, 2009, at 1:49 PM, PCWiz wrote:
Lately I've been getting errors like these with my app:
2009-12-21 13:07:48.420 TwitMenu[2512:a0f] *** -[NSRecursiveLock
unlock]: lock (<NSRecursiveLock: 0x20069d980> '(null)') unlocked
when not locked
2009-12-21 13:07:48.420 TwitMenu[2512:a0f] *** Break on
_NSLockError() to debug.
2009-12-21 13:07:48.437 TwitMenu[2512:4103] *** -[NSRecursiveLock
finalize]: lock (<NSRecursiveLock: 0x20069dca0> '(null)') finalized
while still in use
2009-12-21 13:07:48.437 TwitMenu[2512:4103] *** Break on
_NSLockError() to debug.
As Greg Parker suggested in an earlier question, instead of putting
a breakpoint on NSLockError (which doesn't work) I put a breakpoint
on NSLog. And this is what the debugger looks like:
http://img30.imageshack.us/img30/5894/screenshot20091222at114.png
I dont see how any code in there has a connection to NSRecursiveLock.
Independent Cocoa Developer, Macatomy Software
http://macatomy.com
_______________________________________________
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
_______________________________________________
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