Re: Serious crash from setNeedsDisplayInRect:
Re: Serious crash from setNeedsDisplayInRect:
- Subject: Re: Serious crash from setNeedsDisplayInRect:
- From: j o a r <email@hidden>
- Date: Wed, 9 Feb 2005 14:51:12 +0100
On 2005-02-09, at 14.40, Benjohn wrote:
In the real application, the secondary worker thread (actually
maintained by a completely separate object) is doing considerable
computation to make gradual updates to a model of the image. Once a
piece of update is finished, it tells the view that it will need to
repaint the bit it's just finished working on (until the piece is
ready, a temporary place holder will have been displayed by the view).
As I mention in the original email, it would be nicer to simply have
the worker thread call "setNeedsDisplayInRect:" directly. However:
* [1] Explicitly says that this is a bad idea.
<snip>
[1]
http://developer.apple.com/documentation/Cocoa/Conceptual/
Multithreading/articles/CocoaSafety.html
But it also says that:
"Drawing from secondary threads is thread-safe as long as you bracket
drawing calls with calls to lockFocusIfCanDraw and unlockFocus."
So you might want to try that. That said, keep in mind that there is a
known crash bug with drawing from secondary threads - I've complained
about it on this list not long ago if you're interested about the
details. :-)
If you're hit by that particular bug, I think it could also affect the
retain count of your view, so the problem that you see with your view
being deallocated might be related (but then again, as you're not
currently drawing from the secondary thread, perhaps it isn't...).
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden