[iOS] Fixes TextInput crashes when any text is entered while running as iOS app on apple silicon mac#49320
[iOS] Fixes TextInput crashes when any text is entered while running as iOS app on apple silicon mac#49320zhongwuzw wants to merge 5 commits intofacebook:mainfrom
Conversation
…as iOS app on apple silicon mac
|
This seems really hacky, and is likely to still break. The closest option here would be |
@javache Thanks for your review, can you explain more? you mean we should make |
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
NSData is a class cluster, we shouldn't subclass it. This will likely still fail if UIKit tries to serialize this. |
|
I think we should try Something like? |
|
@javache how do we reconstruct the |
|
Quick sample here: https://gist.github.com/javache/6c5e6f6cbeda31bb033f4ee92678ce8b |
@javache How to compare the eventEmitter? If we don't subclass |
|
This would require a bit of a refactor to |
|
I mean If we use NSData directly and store it in the attributes, when Core Text compared all attributes, it would call https://gist.github.com/javache/6c5e6f6cbeda31bb033f4ee92678ce8b#file-test-mm-L24 |
|
@javache Hi, friendly ping, can we please move on this issue? PS. It's a 100% crash and I see many people added +1 in the issue #48544 (comment). |
|
Sorry for the delay! Just tried with isEqual, and this does seem to work correctly https://gist.github.com/javache/0b7070e50fe7174814c26476c01b7558 Copies of shared_ptr are identical buffers of data, they're just two pointers to a shared piece of memory |
|
@javache Hi, I applied the review feedback. Please review it. It's not crash but seems has many error logs like below, whatever, we can try it :) : |
...rer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h
Outdated
Show resolved
Hide resolved
...rer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h
Outdated
Show resolved
Hide resolved
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
The logs are a bit suspicious, but let's try this out. Please for your test plan, validate that nested text clicks still work. |
...rer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h
Outdated
Show resolved
Hide resolved
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
ok. seems we should use fantom? Maybe I need to learn how to write test and do it in a later PR? |
|
@cipolleschi merged this pull request in 8d7aca3. |
… app on apple silicon mac (#49320) Summary: Fixes #48544. We can make `RCTWeakEventEmitterWrapper` to subclass `NSDictionary` that Textinput supports encode it. System allowed classes are: ``` Allowed classes are: {( "'NSMorphology' (0x20088b6d8) [/System/Library/Frameworks/Foundation.framework]", "'NSString' (0x2003f4738) [/System/Library/Frameworks/Foundation.framework]", "'NSInflectionRule' (0x20088d348) [/System/Library/Frameworks/Foundation.framework]", "'UIColor' (0x2006c0520) [/System/iOSSupport/System/Library/PrivateFrameworks/UIKitCore.framework]", "'NSTextAttachment' (0x20042af98) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSShadow' (0x20042ae30) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSTextEncapsulation' (0x200897e50) [/System/Library/Frameworks/CoreText.framework]", "'NSTextAlternatives' (0x20042af70) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSFont' (0x20042a9f8) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSAttributedString' (0x2003f3838) [/System/Library/Frameworks/Foundation.framework]", "'NSData' (0x2003ed528) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSURL' (0x2003ed938) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSAdaptiveImageGlyph' (0x2008ae538) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSNumber' (0x2003f4238) [/System/Library/Frameworks/Foundation.framework]", "'NSParagraphStyle' (0x20042ad40) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSDictionary' (0x2003ed5a0) [/System/Library/Frameworks/CoreFoundation.framework]", "'UIFont' (0x20042c668) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSColor' (0x200412350) [/System/Library/Frameworks/AppKit.framework]", "'NSGlyphInfo' (0x20042aa98) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSArray' (0x2003ed460) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSPresentationIntent' (0x20088da28) [/System/Library/Frameworks/Foundation.framework]" )} ``` ## Changelog: [IOS] [FIXED] - Fixes TextInput crashes when any text is entered while running as iOS app on apple silicon mac Pull Request resolved: #49320 Test Plan: Run RNTester on apple silicon mac, and entered some text in textinput, no crash occured. Also, verified that the caret was not jumping around, thus preserving the original fix. https://github.com/user-attachments/assets/6304f6e7-c663-4351-ace8-ab1842ee545f Reviewed By: javache Differential Revision: D69981500 Pulled By: cipolleschi fbshipit-source-id: 2af9b280e42f621446efda9b101af50525e8fef7
|
This pull request was successfully merged by @zhongwuzw in 1545169 When will my fix make it into a release? | How to file a pick request? |
… app on apple silicon mac (#49320) Summary: Fixes #48544. We can make `RCTWeakEventEmitterWrapper` to subclass `NSDictionary` that Textinput supports encode it. System allowed classes are: ``` Allowed classes are: {( "'NSMorphology' (0x20088b6d8) [/System/Library/Frameworks/Foundation.framework]", "'NSString' (0x2003f4738) [/System/Library/Frameworks/Foundation.framework]", "'NSInflectionRule' (0x20088d348) [/System/Library/Frameworks/Foundation.framework]", "'UIColor' (0x2006c0520) [/System/iOSSupport/System/Library/PrivateFrameworks/UIKitCore.framework]", "'NSTextAttachment' (0x20042af98) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSShadow' (0x20042ae30) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSTextEncapsulation' (0x200897e50) [/System/Library/Frameworks/CoreText.framework]", "'NSTextAlternatives' (0x20042af70) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSFont' (0x20042a9f8) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSAttributedString' (0x2003f3838) [/System/Library/Frameworks/Foundation.framework]", "'NSData' (0x2003ed528) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSURL' (0x2003ed938) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSAdaptiveImageGlyph' (0x2008ae538) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSNumber' (0x2003f4238) [/System/Library/Frameworks/Foundation.framework]", "'NSParagraphStyle' (0x20042ad40) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSDictionary' (0x2003ed5a0) [/System/Library/Frameworks/CoreFoundation.framework]", "'UIFont' (0x20042c668) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSColor' (0x200412350) [/System/Library/Frameworks/AppKit.framework]", "'NSGlyphInfo' (0x20042aa98) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSArray' (0x2003ed460) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSPresentationIntent' (0x20088da28) [/System/Library/Frameworks/Foundation.framework]" )} ``` ## Changelog: [IOS] [FIXED] - Fixes TextInput crashes when any text is entered while running as iOS app on apple silicon mac Pull Request resolved: #49320 Test Plan: Run RNTester on apple silicon mac, and entered some text in textinput, no crash occured. Also, verified that the caret was not jumping around, thus preserving the original fix. https://github.com/user-attachments/assets/6304f6e7-c663-4351-ace8-ab1842ee545f Reviewed By: javache Differential Revision: D69981500 Pulled By: cipolleschi fbshipit-source-id: 2af9b280e42f621446efda9b101af50525e8fef7
… app on apple silicon mac (#49320) Summary: Fixes #48544. We can make `RCTWeakEventEmitterWrapper` to subclass `NSDictionary` that Textinput supports encode it. System allowed classes are: ``` Allowed classes are: {( "'NSMorphology' (0x20088b6d8) [/System/Library/Frameworks/Foundation.framework]", "'NSString' (0x2003f4738) [/System/Library/Frameworks/Foundation.framework]", "'NSInflectionRule' (0x20088d348) [/System/Library/Frameworks/Foundation.framework]", "'UIColor' (0x2006c0520) [/System/iOSSupport/System/Library/PrivateFrameworks/UIKitCore.framework]", "'NSTextAttachment' (0x20042af98) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSShadow' (0x20042ae30) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSTextEncapsulation' (0x200897e50) [/System/Library/Frameworks/CoreText.framework]", "'NSTextAlternatives' (0x20042af70) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSFont' (0x20042a9f8) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSAttributedString' (0x2003f3838) [/System/Library/Frameworks/Foundation.framework]", "'NSData' (0x2003ed528) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSURL' (0x2003ed938) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSAdaptiveImageGlyph' (0x2008ae538) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSNumber' (0x2003f4238) [/System/Library/Frameworks/Foundation.framework]", "'NSParagraphStyle' (0x20042ad40) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSDictionary' (0x2003ed5a0) [/System/Library/Frameworks/CoreFoundation.framework]", "'UIFont' (0x20042c668) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSColor' (0x200412350) [/System/Library/Frameworks/AppKit.framework]", "'NSGlyphInfo' (0x20042aa98) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSArray' (0x2003ed460) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSPresentationIntent' (0x20088da28) [/System/Library/Frameworks/Foundation.framework]" )} ``` ## Changelog: [IOS] [FIXED] - Fixes TextInput crashes when any text is entered while running as iOS app on apple silicon mac Pull Request resolved: #49320 Test Plan: Run RNTester on apple silicon mac, and entered some text in textinput, no crash occured. Also, verified that the caret was not jumping around, thus preserving the original fix. https://github.com/user-attachments/assets/6304f6e7-c663-4351-ace8-ab1842ee545f Reviewed By: javache Differential Revision: D69981500 Pulled By: cipolleschi fbshipit-source-id: 2af9b280e42f621446efda9b101af50525e8fef7
|
This pull request was successfully merged by @zhongwuzw in adc5c3a When will my fix make it into a release? | How to file a pick request? |
|
This pull request was successfully merged by @zhongwuzw in 282cdc9 When will my fix make it into a release? | How to file a pick request? |
… app on apple silicon mac (#49320) Summary: Fixes #48544. We can make `RCTWeakEventEmitterWrapper` to subclass `NSDictionary` that Textinput supports encode it. System allowed classes are: ``` Allowed classes are: {( "'NSMorphology' (0x20088b6d8) [/System/Library/Frameworks/Foundation.framework]", "'NSString' (0x2003f4738) [/System/Library/Frameworks/Foundation.framework]", "'NSInflectionRule' (0x20088d348) [/System/Library/Frameworks/Foundation.framework]", "'UIColor' (0x2006c0520) [/System/iOSSupport/System/Library/PrivateFrameworks/UIKitCore.framework]", "'NSTextAttachment' (0x20042af98) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSShadow' (0x20042ae30) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSTextEncapsulation' (0x200897e50) [/System/Library/Frameworks/CoreText.framework]", "'NSTextAlternatives' (0x20042af70) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSFont' (0x20042a9f8) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSAttributedString' (0x2003f3838) [/System/Library/Frameworks/Foundation.framework]", "'NSData' (0x2003ed528) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSURL' (0x2003ed938) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSAdaptiveImageGlyph' (0x2008ae538) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSNumber' (0x2003f4238) [/System/Library/Frameworks/Foundation.framework]", "'NSParagraphStyle' (0x20042ad40) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSDictionary' (0x2003ed5a0) [/System/Library/Frameworks/CoreFoundation.framework]", "'UIFont' (0x20042c668) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSColor' (0x200412350) [/System/Library/Frameworks/AppKit.framework]", "'NSGlyphInfo' (0x20042aa98) [/System/Library/PrivateFrameworks/UIFoundation.framework]", "'NSArray' (0x2003ed460) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSPresentationIntent' (0x20088da28) [/System/Library/Frameworks/Foundation.framework]" )} ``` ## Changelog: [IOS] [FIXED] - Fixes TextInput crashes when any text is entered while running as iOS app on apple silicon mac Pull Request resolved: #49320 Test Plan: Run RNTester on apple silicon mac, and entered some text in textinput, no crash occured. Also, verified that the caret was not jumping around, thus preserving the original fix. https://github.com/user-attachments/assets/6304f6e7-c663-4351-ace8-ab1842ee545f Reviewed By: javache Differential Revision: D69981500 Pulled By: cipolleschi fbshipit-source-id: 2af9b280e42f621446efda9b101af50525e8fef7
|
This pull request was successfully merged by @zhongwuzw in e2b081e When will my fix make it into a release? | How to file a pick request? |


Summary:
Fixes #48544. We can make
RCTWeakEventEmitterWrapperto subclassNSDictionarythat Textinput supports encode it.System allowed classes are:
Changelog:
[IOS] [FIXED] - Fixes TextInput crashes when any text is entered while running as iOS app on apple silicon mac
Test Plan:
Run RNTester on apple silicon mac, and entered some text in textinput, no crash occured. Also, verified that the caret was not jumping around, thus preserving the original fix.
Screen.Recording.2025-02-21.at.10.53.33.mov