Re: unable to update UI on main thread in 10.13
Re: unable to update UI on main thread in 10.13
- Subject: Re: unable to update UI on main thread in 10.13
- From: Quincey Morris <email@hidden>
- Date: Fri, 27 Oct 2017 10:58:43 -0700
On Oct 27, 2017, at 07:40 , sqwarqDev <email@hidden> wrote:
>
> It seems to be when the superAttributedString is added that I get the
> warnings.
— Is that backtrace from the main thread?
— The symptoms you describe might be explained if the text storage is holding
on to a reference to the attributed string object you set, and you subsequently
modify the same attributed string object. After you “push” the object in
“superAttributedString” to the main thread, do you create a new object in that
variable? What happens if you set a copy of the attributed string into the text
storage? Something like:
>
> self.profilerTextView.textStorage?.setAttributedString(self.superAttributedString.copy
> ())
Better still, don’t store the attributed string persistently anywhere, but pass
it through the background processing then on to the main thread as a parameter
to the updateUI function.
Also, in this context:
> I AM seeing odd behaviour in 10.13 (the attributed string is supposed to bold
> certain parts of the text, but one time in ten or so in 10.13 it just goes
> gung-ho and bolds the lot)
it sounds like it could be a thread safety issue, which could lead to both this
and the original problem.
_______________________________________________
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