-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
textPublisher crash when using emoji #34
Comments
When I switch to the good ol' textViewDidChange delegate method, no crash. It also doesn't crash using UITextField, only UITextView. |
Can you attach a repro project to save some time? @kevinrenskers |
Will do. |
Hey @kevinrenskers - I don't think there's any bug with the library per-se here, since if you replace it with a print, everything works: I think the real problem is that you're introducing reentrancy - you are assigning a value of something that effects that very same value. In this specific case the crash is:
Which seems reasonable (you are editing and writing, e.g. causing a layout at the exact same time or at a timing that causes a reentrancy/race). |
But it works with all text just fine, just not emoji. |
Yup, I imagine drawing grapheme clusters is a different task that requires different handling. Regardless this error comes from NSTextStorage and not from CombineCocoa itself. I'm not too sure if I have an idea for something that could be done here. |
I wonder if it's something in Like I said, if you build the exact same functionality using good old textViewDidChange, it doesn't crash.
|
There is nothing reentrant about this code though. I don't think the delegate gets called when the sink hits the |
So, it's not the assigning that's the problem (I still have the |
It also doesn't crash if you replace both UITextView with a UITextField, which don't use the |
UITextView is a beast of a controller. It is nothing like UITextField which isn’t backed by NSTextStorage. Ill try to fiddle with it to see if I have some ideas on how to avoid or defer the reentrancy somehow. Thanks!
…On 21 Nov 2020, 21:44 +0200, Kevin Renskers ***@***.***>, wrote:
It also doesn't crash if you replace both UITextView with a UITextField, which don't use the didProcessEditingRangeChangeInLengthPublisher, which is why my mind is going in that direction.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
With the addition on my PR #73, the example @kevinrenskers provided doesn't crash but you do get a circular dependency, and the app loops since you're saving the values from the |
I have two UITextView's that I am using
textPublisher
on, to keep them in sync with each other.It all works, until you type an emoji: then the app crashes.
The text was updated successfully, but these errors were encountered: