-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Can't update Text via setState #749
Comments
I generated a new app which is running 0.3.7 and I see this too. This works:
However this doesn't - it causes a crash:
|
+1 |
Wow this is bad. @a2, @nicklockwood ? |
Ah, I know the problem. Will look in a couple hours. |
I can confirm that I ran into the same issue with the newest version and I had to downgrade |
Yup. Mea culpa. Will fix shortly. |
@a2 - thank you sir |
+1 |
+1 Crashes anytime |
+1 on this as well.. |
A fix for this is landing internally and will be updated on GitHub at the next sync. Thanks for bringing this to my attention. 🍻 |
got that,thanks. |
Had the very same issue at v0.3.8. At v0.3.10, it no longer occurs. |
Ah, looks like my fix landed in 0686b01. Feel free to reopen this issue (or create a new one) if a similar problem appears. Thanks! |
@a2 0.3.10, works perfectly, thank you! |
Summary: Fix `RCTText` crashes by wholly replacing the underlying `NSTextStorage`. This fixes GitHub issues facebook#748, facebook#749, and facebook#756. Test Plan: There are a couple sample apps in facebook#749 that I used for testing this.
If I try and update the value of Text via setState (which I am assuming should be possible), XCode crashes, with the following stack trace:
2015-04-08 13:17:00.675 SampleApp[3432:124680] !!! _NSLayoutTreeLineFragmentRectForGlyphAtIndex invalid glyph index 7
2015-04-08 13:17:00.716 SampleApp[3432:124680] * Terminating app due to uncaught exception 'NSRangeException', reason: '* NSRunStorage, _NSBlockNumberForIndex(): index (7) beyond array bounds (0)'
*** First throw call stack:
(
0 CoreFoundation 0x0000000107de8a75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000107262bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000107de89ad +[NSException raise:format:] + 205
3 UIFoundation 0x000000010fce2c8f _NSBlockNumberForIndex + 84
4 UIFoundation 0x000000010fca1e27 -[NSLayoutManager(NSPrivate) _invalidateGlyphsForExtendedCharacterRange:changeInLength:includeBlocks:] + 786
5 UIFoundation 0x000000010fccf692 -[NSLayoutManager _invalidateGlyphsForCharacterRange:editedCharacterRange:changeInLength:actualCharacterRange:] + 176
6 UIFoundation 0x000000010fcd1934 -[NSLayoutManager textStorage:edited:range:changeInLength:invalidatedRange:] + 208
7 UIFoundation 0x000000010fcf80ba -[NSTextStorage _notifyEdited:range:changeInLength:invalidatedRange:] + 152
8 UIFoundation 0x000000010fcf7bf2 -[NSTextStorage processEditing] + 367
9 UIFoundation 0x000000010fcf7a4c -[NSTextStorage edited:range:changeInLength:] + 305
10 Foundation 0x0000000106e0c2f8 -[NSConcreteMutableAttributedString replaceCharactersInRange:withAttributedString:] + 330
11 UIFoundation 0x000000010fcf9919 -[NSConcreteTextStorage replaceCharactersInRange:withAttributedString:] + 78
12 SampleApp 0x000000010696ca3a -[RCTText setAttributedText:] + 106
13 SampleApp 0x000000010696bd09 __55-[RCTTextManager uiBlockToAmendWithShadowViewRegistry:]_block_invoke_2 + 201
14 SampleApp 0x0000000106908683 __45-[RCTSparseArray enumerateObjectsUsingBlock:]_block_invoke + 147
15 CoreFoundation 0x0000000107d29ec6 __65-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 102
16 CoreFoundation 0x0000000107d29dcc -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 204
17 SampleApp 0x00000001069085af -[RCTSparseArray enumerateObjectsUsingBlock:] + 415
18 SampleApp 0x000000010696bbf0 __55-[RCTTextManager uiBlockToAmendWithShadowViewRegistry:]_block_invoke + 208
19 SampleApp 0x000000010696bfeb __55-[RCTTextManager uiBlockToAmendWithShadowViewRegistry:]_block_invoke137 + 443
20 SampleApp 0x0000000106935c6c __27-[RCTUIManager addUIBlock:]_block_invoke + 124
21 SampleApp 0x000000010693ebb6 __29-[RCTUIManager flushUIBlocks]_block_invoke + 342
22 libdispatch.dylib 0x000000010acd3186 _dispatch_call_block_and_release + 12
23 libdispatch.dylib 0x000000010acf2614 _dispatch_client_callout + 8
24 libdispatch.dylib 0x000000010acdaa1c _dispatch_main_queue_callback_4CF + 1664
25 CoreFoundation 0x0000000107d50749 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9
26 CoreFoundation 0x0000000107d1362b __CFRunLoopRun + 2043
27 CoreFoundation 0x0000000107d12bc6 CFRunLoopRunSpecific + 470
28 GraphicsServices 0x000000010b75aa58 GSEventRunModal + 161
29 UIKit 0x0000000109812580 UIApplicationMain + 1282
30 SampleApp 0x00000001068af033 main + 115
31 libdyld.dylib 0x000000010ad27145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
This happens in even the simplest of apps, e.g.
Any ideas?
Running OSX 10.9.5 and XCode 6.2.
The text was updated successfully, but these errors were encountered: