Re: NSTextView replaceCharactersInRange performance and thread safety
Re: NSTextView replaceCharactersInRange performance and thread safety
- Subject: Re: NSTextView replaceCharactersInRange performance and thread safety
- From: David Kocher <email@hidden>
- Date: Tue, 4 Jan 2005 21:31:17 +0100
Douglas,
Thanks for the response! Indeed this seems to improve the performance;
I was calling setFont: as the NSTextView reverts back the default
Helvetica font if inserting a non-attributed string; I suppose this to
be a bug.
Frequent call to scrollRangeToVisible: still freezes/blocks the main
thread (getting the spinning ball). I am however not sure if
scrollRangeToVisible: can be called from another thread (I assume the
appkit is not thread safe in general) - there doesn't seem to be much
documentation on this topic.
Thanks!
-dk
On 4. Jan 2005, at 21:05, Douglas Davidson wrote:
On Jan 4, 2005, at 11:51 AM, David Kocher wrote:
The implementation of "replaceCharactersInRange" and
"scrollRangeToVisible" in NSTextView seems to be *very* slow making
it impossible for me to use a NSTextView for logging. The problem has
also been discussed at [
http://www.cocoadev.com/index.pl?FastWritesToNSTextView ] with no
solution provided it seems.
I also had infrequent crashes when calling the above methods from a
different thread than the main thread; it seems it isn't thread safe.
I notice that you are calling setFont: on the text view, which could
potentially cause the whole text to be relaid. Try creating an
attributed string with your desired font and inserting that into the
text at the end.
Douglas Davidson
_______________________________________________
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