Re: NSRecursiveLock problems

2010-01-05 Thread Stuart Carnie
Check out PLBlocks http://code.google.com/p/plblocks/ if you want to use blocks on 10.5. Cheers, Stu On Tue, Dec 22, 2009 at 12:49 PM, PCWiz pcwiz.supp...@gmail.com wrote: Well what I meant by delegates and selectors was like the secondary thread calls a selector on the main thread (using

Re: NSRecursiveLock problems

2009-12-23 Thread Douglas Davidson
On Dec 22, 2009, at 6:07 PM, PCWiz wrote: The issue class in my case is NSLayoutManager. I dug through the docs for NSLayoutManager and read the section on thread safety. There were 2 steps to achieving thread safety with NSLayoutManager. First, if the NSLayoutManager belonged to an

Re: NSRecursiveLock problems

2009-12-23 Thread PCWiz
It all seems to be stable now, so turning off background layout worked :-) Thanks Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2009-12-23, at 9:45 AM, Douglas Davidson wrote: On Dec 22, 2009, at 6:07 PM, PCWiz wrote: The issue class in my case is

Re: NSRecursiveLock problems

2009-12-23 Thread PCWiz
Glad to meet you, the DSClickableURLTextField class has been excellent :) I didn't subclass it, I just made my own little modifications to it here and there. Here is the minSizeForContent method: - (NSSize)minSizeForContent { // Grab the height for the text float newHeight =

Re: NSRecursiveLock problems

2009-12-22 Thread PCWiz
Scrap that, I managed to find where the problem is happening. Debugger: http://img709.imageshack.us/img709/9758/screenshot20091222at115.png I didn't know that NSInvocationOperation used NSRecursiveLock. But this still doesn't really help me understand *why* I'm getting these errors. The use of

Re: NSRecursiveLock problems

2009-12-22 Thread Chris Backas
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

Re: NSRecursiveLock problems

2009-12-22 Thread PCWiz
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

Re: NSRecursiveLock problems

2009-12-22 Thread Bill Bumgarner
On Dec 22, 2009, at 11:19 AM, PCWiz wrote: Is there any easy way to execute a portion of code on the main thread without going through the mess of delegates and selectors? Delegates have *nothing* to do with main thread execution. Selectors a bit orthogonal, too. If you want to execute

Re: NSRecursiveLock problems

2009-12-22 Thread PCWiz
Well what I meant by delegates and selectors was like the secondary thread calls a selector on the main thread (using performSelectorOnMainThread) but I guess I got a little confused there :) I would like to use blocks, however I'm using the 10.5 SDK so as far as I know blocks cannot be used.

Re: NSRecursiveLock problems

2009-12-22 Thread Greg Guerin
PCWiz wrote: I would like to use blocks, however I'm using the 10.5 SDK so as far as I know blocks cannot be used. Is there a way to get performSelectorOnMainThread to return a value? That would solve my issue, because I could pass on the NSAttributedString to a method on the main thread

Re: NSRecursiveLock problems

2009-12-22 Thread PCWiz
So for example I could do performSelectorOnMainThread with an NSMutableArray, for example, then have the method add the result object to the array and return it? Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2009-12-22, at 1:29 PM, Greg Guerin wrote: I would like

Re: NSRecursiveLock problems

2009-12-22 Thread Greg Guerin
PCWiz wrote: So for example I could do performSelectorOnMainThread with an NSMutableArray, for example, then have the method add the result object to the array and return it? As long as no other threads were doing anything with that array, I think that would work. Or define a very

Re: NSRecursiveLock problems

2009-12-22 Thread PCWiz
I think I have actually found a one line solution for this problem. The issue class in my case is NSLayoutManager. I dug through the docs for NSLayoutManager and read the section on thread safety. There were 2 steps to achieving thread safety with NSLayoutManager. First, if the NSLayoutManager