Skip to content
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

Multiline TextInput crashes after buffer has a certain number of characters and they are deleted #486

Closed
ospfranco opened this issue Jul 7, 2020 · 2 comments · Fixed by #489

Comments

@ospfranco
Copy link

Environment

"react-native-macos": "^0.61.54"

Issue

Steps to Reproduce

on a <TextInput multiline /> try to write several characters (number seems to ~100 - ~300) after you have enough characters in the buffer, try to delete a few of them, react-native will crash:

Screenshot 2020-06-30 at 19 16 36

Screenshot 2020-07-06 at 16 19 58

The problem was happening a lot more often with an older version, now it doesn't happen as often, but still occurs every once in a while, it might take a lot of typing/deleting to reproduce the problem

@tido64
Copy link
Member

tido64 commented Jul 8, 2020

@ospfranco: Do you have the opportunity to try out my branch? I think I've addressed it but it's hard to repro this bug to begin with so I'm not 100%.

@ospfranco
Copy link
Author

ospfranco commented Jul 8, 2020

awesome! I'm at work right now, I'll try to make some room tonight, thanks for looking into it!

facebook-github-bot pushed a commit to facebook/react-native that referenced this issue Jul 17, 2020
…29307)

Summary:
Multiline `TextInput` can crash when really long texts are inserted and removed quickly. This is caused by the fact that [`-[NSAttributedString string]`](https://developer.apple.com/documentation/foundation/nsattributedstring/1412616-string?language=objc) doesn't really return a copy, and may mutate the string while it is being used by `convertIdToFollyDynamic`. See microsoft#489 (comment) for more details on the issue.

This issue was originally reported in microsoft#486 and was fixed in microsoft#489.

## Changelog

[iOS] [Fixed] - Fix multiline TextInput crash when inserting/removing lots of text

Pull Request resolved: #29307

Test Plan:
1. Open RNTester > TextInput
2. Search for a multiline example
3. Copy some large text and paste it into the text input view
4. Remove some (or all) text
5. Repeat steps 3-4

Reviewed By: shergin

Differential Revision: D22488854

Pulled By: JoshuaGross

fbshipit-source-id: 6fab7818d68538450d93460361ff5934caf86c10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants