 |
 |
"layout manager 15072a0 failed to progress..."
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status:
Offline
|
|
Okay, what the heck does this mean:
Aug 07 18:58:17 Primer[928] *** layout manager 15072a0 failed to progress beyond index 7765 while drawing glyphs.
I get this while executing a little java-cocoa app. It's suppose to find primes, which it will do up to a point, and then I get this drawing error and the program crashes. The way I have it set up, a user enters a number of primes to find, my main Object creates a thread that finds them one at a time and printing them to the screen in a NSTextView. It was actually working well without a thread, and even worked fine when I implemented threads incorrectly by calling run() instead of start() off my thread. I don't know how threading and this layout manager are related at all...
Any ideas?
Thanks,
F-bacher
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status:
Offline
|
|
Oh, one more thing, it works fine if I just output the primes to a text file instead of the screen. The only calls my Thread method makes that relate to NSTextView are:
output.inserText(currentPrime);
and
output.displayIfNeeded();
Where output is my NSTextView object and currentPrime is the String object of a prime to print.
F-bacher
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Mar 2000
Location: Ithaca, NY
Status:
Offline
|
|
Many objects in the AppKit are not thread safe. I don't know the exact cause of your error, but my best guess is that your worker thread is trying to insert text into the text view while the view is in the process of redisplaying the text from the previous insertion. There are several ways to deal with this, depending on how much work you want to do.
The simplest way would be to just wait until all the numbers are done being generated before outputting all of it to the text view. This does of course mean that you won't get to see progress being made, but it's a simple fix.
The harder way would be to set up an NSConnection between your two threads and send updates from your worker thread to the main thread. That way, your updates would be queued up in the main thread and you wouldn't have any race conditions.
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Oct 2000
Location: Pasadena, CA, USA
Status:
Offline
|
|
You could probably just synchronize access to the java method you're using to set the NSTextField. So instead of
public void setTextField(String val)
You would have
public synchronised void setTextField(String val)
And the Java VM will make sure your threads don't clash calling this method.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |