Skip to content

iOS 9.0.2 and iOS 9.1 Crash #601

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

Open
wssand44 opened this issue Oct 26, 2015 · 11 comments
Open

iOS 9.0.2 and iOS 9.1 Crash #601

wssand44 opened this issue Oct 26, 2015 · 11 comments

Comments

@wssand44
Copy link

it crash on iOS 9 version, when i used TTTAttributedLabel in my app.
i found the crash is happend on i set the font size and my text contains ‘👿\n’ (emoji and
newline symbol).

@wssand44
Copy link
Author

i found CTFramesetterSuggestFrameSizeForAttributedStringWithConstraints cause the crash.

@wssand44
Copy link
Author

@"😚😚😚😚😚😚\n\n\n\n\n\n\n\n中午哇哇哇"

@qfish
Copy link

qfish commented Oct 26, 2015

Give the property preferredMaxLayoutWidth of UILabel some value.

  1. Using XIB:
    screen shot 2015-10-26 at 11 00 58 am
  2. Or coding like this:
label.preferredMaxLayoutWidth = 0;

@wssand44
Copy link
Author

I have set preferredMaxLayoutWidth = 0,but it does not help.
" CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);" cause the OOM

@syljay0508
Copy link

@wssand44 I got the same crash , some text maybe cause the oom

@syljay0508
Copy link

@qfish hi,参照了您的这个方案还是没有生效。我这边的使用情况是numberOfLines = 5设置了这个属性,如果去掉这个属性的设置并不会发生OOM。

@jackrex
Copy link

jackrex commented Nov 5, 2015

WTF, when to fix this

@jkyin
Copy link

jkyin commented Nov 6, 2015

Crash for iOS 9.1.

qq20151106-0 2x

bt print log:

* thread #1: tid = 0x49f51, 0x06db7dd0 libobjc.A.dylib`objc_exception_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x06db7dd0 libobjc.A.dylib`objc_exception_throw
    frame #1: 0x06a56dd3 CoreFoundation`-[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    frame #2: 0x06994cdd CoreFoundation`___forwarding___ + 1037
    frame #3: 0x069948ae CoreFoundation`__forwarding_prep_0___ + 14
    frame #4: 0x0c29f99e UIFoundation`-[NSLayoutManager(NSPrivate) _blockRowRangeForCharRange:completeRows:] + 138
    frame #5: 0x0c29fce0 UIFoundation`-[NSLayoutManager(NSPrivate) _blockRowRangeForCharRange:] + 56
    frame #6: 0x0c2e0dd8 UIFoundation`-[NSLayoutManager invalidateDisplayForCharacterRange:] + 109
    frame #7: 0x0c2e0fc8 UIFoundation`-[NSLayoutManager invalidateDisplayForGlyphRange:] + 75
    frame #8: 0x0c2a23b7 UIFoundation`-[NSLayoutManager(NSPrivate) _fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:] + 4813
    frame #9: 0x0c2a3037 UIFoundation`-[NSLayoutManager(NSPrivate) _fillLayoutHoleAtIndex:desiredNumberOfLines:] + 243
    frame #10: 0x0c2a3771 UIFoundation`-[NSLayoutManager(NSPrivate) _markSelfAsDirtyForBackgroundLayout:] + 381
    frame #11: 0x0c2dcec2 UIFoundation`-[NSLayoutManager setTextStorage:] + 724
    frame #12: 0x0c30c2a6 UIFoundation`-[NSTextStorage addLayoutManager:] + 104
  * frame #13: 0x00c34244 Tofu`-[TTTAttributedLabel boundingRectForCharacterRange:](self=0x7e9879c0, _cmd="boundingRectForCharacterRange:", range=location=0, length=5) + 260 at TTTAttributedLabel.m:805
    frame #14: 0x00c3c066 Tofu`-[TTTAttributedLabel accessibilityElements](self=0x7e9879c0, _cmd="accessibilityElements") + 1894 at TTTAttributedLabel.m:1389
    frame #15: 0x00c3b781 Tofu`-[TTTAttributedLabel accessibilityElementCount](self=0x7e9879c0, _cmd="accessibilityElementCount") + 49 at TTTAttributedLabel.m:1359
    frame #16: 0x1471cec0 UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityHasOrderedChildren] + 61
    frame #17: 0x14713012 UIAccessibility`-[UIView(UIAccessibilityElementTraversal) _accessibilityShouldBeAddedToViewChildrenWithOptions:] + 96
    frame #18: 0x14713c2b UIAccessibility`-[UIView(UIAccessibilityElementTraversal) _addAccessibilityElementsAndOrderedContainersWithOptions:toCollection:] + 93
    frame #19: 0x14713ee8 UIAccessibility`-[UIView(UIAccessibilityElementTraversal) _addAccessibilityElementsAndOrderedContainersWithOptions:toCollection:] + 794
    frame #20: 0x14713ee8 UIAccessibility`-[UIView(UIAccessibilityElementTraversal) _addAccessibilityElementsAndOrderedContainersWithOptions:toCollection:] + 794
    frame #21: 0x14714353 UIAccessibility`+[UIView(UIAccessibilityElementTraversal) _accessibilityElementsAndContainersDescendingFromViews:options:sorted:] + 426
    frame #22: 0x1471455b UIAccessibility`-[UIView(UIAccessibilityElementTraversal) _accessibilityViewChildrenWithOptions:] + 206
    frame #23: 0x145e54ed UIKit`-[UITableViewCellAccessibility _accessibilityRetrieveTableViewCellText] + 1312
    frame #24: 0x145e6064 UIKit`-[UITableViewCellAccessibility _accessibilityChildren] + 1319
    frame #25: 0x145e7b02 UIKit`-[UITableViewCellAccessibility accessibilityElementCount] + 202
    frame #26: 0x1471cce7 UIAccessibility`-[NSObject(AXPrivCategory) accessibilityEnumerateContainerElementsWithOptions:usingBlock:] + 425
    frame #27: 0x1471ce7b UIAccessibility`-[NSObject(AXPrivCategory) accessibilityEnumerateContainerElementsUsingBlock:] + 75
    frame #28: 0x145e411f UIKit`-[UITableViewCellAccessibility _accessibilityHitTest:withEvent:] + 1660
    frame #29: 0x145ef41f UIKit`-[UIViewAccessibility __accessibilityHitTest:withEvent:] + 1626
    frame #30: 0x145eff9f UIKit`-[UIViewAccessibility _accessibilityHitTest:withEvent:] + 90
    frame #31: 0x145ef41f UIKit`-[UIViewAccessibility __accessibilityHitTest:withEvent:] + 1626
    frame #32: 0x145daebc UIKit`-[UITableViewAccessibility _accessibilityHitTest:withEvent:] + 322
    frame #33: 0x14eb5b97 PreferencesFramework`-[PreferencesTableViewAccessibility _accessibilityHitTest:withEvent:] + 80
    frame #34: 0x145ef41f UIKit`-[UIViewAccessibility __accessibilityHitTest:withEvent:] + 1626
    frame #35: 0x145eff9f UIKit`-[UIViewAccessibility _accessibilityHitTest:withEvent:] + 90
    frame #36: 0x145ef41f UIKit`-[UIViewAccessibility __accessibilityHitTest:withEvent:] + 1626
    frame #37: 0x145eff9f UIKit`-[UIViewAccessibility _accessibilityHitTest:withEvent:] + 90
    frame #38: 0x145ef41f UIKit`-[UIViewAccessibility __accessibilityHitTest:withEvent:] + 1626
    frame #39: 0x145eff9f UIKit`-[UIViewAccessibility _accessibilityHitTest:withEvent:] + 90
    frame #40: 0x145ef41f UIKit`-[UIViewAccessibility __accessibilityHitTest:withEvent:] + 1626
    frame #41: 0x145eff9f UIKit`-[UIViewAccessibility _accessibilityHitTest:withEvent:] + 90
    frame #42: 0x145ef41f UIKit`-[UIViewAccessibility __accessibilityHitTest:withEvent:] + 1626
    frame #43: 0x145eff9f UIKit`-[UIViewAccessibility _accessibilityHitTest:withEvent:] + 90
    frame #44: 0x145ef41f UIKit`-[UIViewAccessibility __accessibilityHitTest:withEvent:] + 1626
    frame #45: 0x145eff9f UIKit`-[UIViewAccessibility _accessibilityHitTest:withEvent:] + 90
    frame #46: 0x145ef41f UIKit`-[UIViewAccessibility __accessibilityHitTest:withEvent:] + 1626
    frame #47: 0x145eff9f UIKit`-[UIViewAccessibility _accessibilityHitTest:withEvent:] + 90
    frame #48: 0x1460593d UIKit`-[UIWindowAccessibility _accessibilityHitTest:withEvent:] + 106
    frame #49: 0x1470ade1 UIAccessibility`_copyElementAtPositionCallback + 1595
    frame #50: 0x1479b88b AXRuntime`_AXXMIGCopyElementAtPosition + 266
    frame #51: 0x14794ada AXRuntime`_XCopyElementAtPosition + 372
    frame #52: 0x147a43ab AXRuntime`mshMIGPerform + 313
    frame #53: 0x06967fc5 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
    frame #54: 0x06967f30 CoreFoundation`__CFRunLoopDoSource1 + 512
    frame #55: 0x0695d3e6 CoreFoundation`__CFRunLoopRun + 2598
    frame #56: 0x0695c706 CoreFoundation`CFRunLoopRunSpecific + 470
    frame #57: 0x0695c51b CoreFoundation`CFRunLoopRunInMode + 123
    frame #58: 0x08094664 GraphicsServices`GSEventRunModal + 192
    frame #59: 0x080944a1 GraphicsServices`GSEventRun + 104
    frame #60: 0x03f101eb UIKit`UIApplicationMain + 160
    frame #61: 0x00123c53 Tofu`main(argc=1, argv=0xbff1a784) + 131 at main.m:19
    frame #62: 0x0740fa21 libdyld.dylib`start + 1

the mutableAttributedString print log:

Printing description of mutableAttributedString:
看,流行鱼{
    CTForegroundColor = "<CGColor 0x7e9696f0> [<CGColorSpace 0x79781e80> (kCGColorSpaceDeviceRGB)] ( 0.501961 0.501961 0.501961 1 )";
    NSFont = "<UICTFont: 0x7e971580> font-family: \"Helvetica\"; font-weight: normal; font-style: normal; font-size: 12.00pt";
    NSKern = 0;
    NSParagraphStyle = "<CTParagraphStyle: 0x79b88060>{base writing direction = -1, alignment = 4, line break mode = 0, default tab interval = 0\nfirst line head indent = 0, head indent = 0, tail indent = 0\nline height multiple = 0, maximum line height = 0, minimum line height = 0\nline spacing adjustment = 4, paragraph spacing = 0, paragraph spacing before = 0\ntabs = <CFArray 0x79b882d0 [0x6c77098]>{type = immutable, count = 12, values = (\n\t0 : <CTTextTab: 0x79b88090>{location = 28, alignment = 0, options = (null)}\n\t1 : <CTTextTab: 0x79b880c0>{location = 56, alignment = 0, options = (null)}\n\t2 : <CTTextTab: 0x79b880f0>{location = 84, alignment = 0, options = (null)}\n\t3 : <CTTextTab: 0x79b88120>{location = 112, alignment = 0, options = (null)}\n\t4 : <CTTextTab: 0x79b88150>{location = 140, alignment = 0, options = (null)}\n\t5 : <CTTextTab: 0x79b88180>{location = 168, alignment = 0, options = (null)}\n\t6 : <CTTextTab: 0x79b881b0>{location = 196, alignment = 0, options = (null)}\n\t7 : <CTTextTab: 0x79b881e0>{location = 224, alignment = 0, options = (null)}\n\t8 : <CTTextTab: 0x79b88210>{location = 252, alignment = 0, options = (null)}\n\t9 : <CTTextTab: 0x79b88240>{location = 280, alignment = 0, options = (null)}\n\t10 : <CTTextTab: 0x79b88270>{location = 308, alignment = 0, options = (null)}\n\t11 : <CTTextTab: 0x79b882a0>{location = 336, alignment = 0, options = (null)}\n)}}";
    NSUnderline = 0;
}回复{
    CTForegroundColor = "<CGColor 0x79b87eb0> [<CGColorSpace 0x79781e80> (kCGColorSpaceDeviceRGB)] ( 0.188235 0.188235 0.188235 1 )";
    NSFont = "<UICTFont: 0x79b876b0> font-family: \"Helvetica Neue\"; font-weight: normal; font-style: normal; font-size: 14.00pt";
    NSKern = 0;
    NSParagraphStyle = "<CTParagraphStyle: 0x79b88060>{base writing direction = -1, alignment = 4, line break mode = 0, default tab interval = 0\nfirst line head indent = 0, head indent = 0, tail indent = 0\nline height multiple = 0, maximum line height = 0, minimum line height = 0\nline spacing adjustment = 4, paragraph spacing = 0, paragraph spacing before = 0\ntabs = <CFArray 0x79b882d0 [0x6c77098]>{type = immutable, count = 12, values = (\n\t0 : <CTTextTab: 0x79b88090>{location = 28, alignment = 0, options = (null)}\n\t1 : <CTTextTab: 0x79b880c0>{location = 56, alignment = 0, options = (null)}\n\t2 : <CTTextTab: 0x79b880f0>{location = 84, alignment = 0, options = (null)}\n\t3 : <CTTextTab: 0x79b88120>{location = 112, alignment = 0, options = (null)}\n\t4 : <CTTextTab: 0x79b88150>{location = 140, alignment = 0, options = (null)}\n\t5 : <CTTextTab: 0x79b88180>{location = 168, alignment = 0, options = (null)}\n\t6 : <CTTextTab: 0x79b881b0>{location = 196, alignment = 0, options = (null)}\n\t7 : <CTTextTab: 0x79b881e0>{location = 224, alignment = 0, options = (null)}\n\t8 : <CTTextTab: 0x79b88210>{location = 252, alignment = 0, options = (null)}\n\t9 : <CTTextTab: 0x79b88240>{location = 280, alignment = 0, options = (null)}\n\t10 : <CTTextTab: 0x79b88270>{location = 308, alignment = 0, options = (null)}\n\t11 : <CTTextTab: 0x79b882a0>{location = 336, alignment = 0, options = (null)}\n)}}";
}雨漠{
    CTForegroundColor = "<CGColor 0x7e9696f0> [<CGColorSpace 0x79781e80> (kCGColorSpaceDeviceRGB)] ( 0.501961 0.501961 0.501961 1 )";
    NSFont = "<UICTFont: 0x7e971580> font-family: \"Helvetica\"; font-weight: normal; font-style: normal; font-size: 12.00pt";
    NSKern = 0;
    NSParagraphStyle = "<CTParagraphStyle: 0x79b88060>{base writing direction = -1, alignment = 4, line break mode = 0, default tab interval = 0\nfirst line head indent = 0, head indent = 0, tail indent = 0\nline height multiple = 0, maximum line height = 0, minimum line height = 0\nline spacing adjustment = 4, paragraph spacing = 0, paragraph spacing before = 0\ntabs = <CFArray 0x79b882d0 [0x6c77098]>{type = immutable, count = 12, values = (\n\t0 : <CTTextTab: 0x79b88090>{location = 28, alignment = 0, options = (null)}\n\t1 : <CTTextTab: 0x79b880c0>{location = 56, alignment = 0, options = (null)}\n\t2 : <CTTextTab: 0x79b880f0>{location = 84, alignment = 0, options = (null)}\n\t3 : <CTTextTab: 0x79b88120>{location = 112, alignment = 0, options = (null)}\n\t4 : <CTTextTab: 0x79b88150>{location = 140, alignment = 0, options = (null)}\n\t5 : <CTTextTab: 0x79b88180>{location = 168, alignment = 0, options = (null)}\n\t6 : <CTTextTab: 0x79b881b0>{location = 196, alignment = 0, options = (null)}\n\t7 : <CTTextTab: 0x79b881e0>{location = 224, alignment = 0, options = (null)}\n\t8 : <CTTextTab: 0x79b88210>{location = 252, alignment = 0, options = (null)}\n\t9 : <CTTextTab: 0x79b88240>{location = 280, alignment = 0, options = (null)}\n\t10 : <CTTextTab: 0x79b88270>{location = 308, alignment = 0, options = (null)}\n\t11 : <CTTextTab: 0x79b882a0>{location = 336, alignment = 0, options = (null)}\n)}}";
    NSUnderline = 0;
}:哦!!!!我傻了眼滑!!!!爷爷毛长点!!!太久没看到家教的一时把持不住_(:з)∠)_{
    CTForegroundColor = "<CGColor 0x79b87eb0> [<CGColorSpace 0x79781e80> (kCGColorSpaceDeviceRGB)] ( 0.188235 0.188235 0.188235 1 )";
    NSFont = "<UICTFont: 0x79b876b0> font-family: \"Helvetica Neue\"; font-weight: normal; font-style: normal; font-size: 14.00pt";
    NSKern = 0;
    NSParagraphStyle = "<CTParagraphStyle: 0x79b88060>{base writing direction = -1, alignment = 4, line break mode = 0, default tab interval = 0\nfirst line head indent = 0, head indent = 0, tail indent = 0\nline height multiple = 0, maximum line height = 0, minimum line height = 0\nline spacing adjustment = 4, paragraph spacing = 0, paragraph spacing before = 0\ntabs = <CFArray 0x79b882d0 [0x6c77098]>{type = immutable, count = 12, values = (\n\t0 : <CTTextTab: 0x79b88090>{location = 28, alignment = 0, options = (null)}\n\t1 : <CTTextTab: 0x79b880c0>{location = 56, alignment = 0, options = (null)}\n\t2 : <CTTextTab: 0x79b880f0>{location = 84, alignment = 0, options = (null)}\n\t3 : <CTTextTab: 0x79b88120>{location = 112, alignment = 0, options = (null)}\n\t4 : <CTTextTab: 0x79b88150>{location = 140, alignment = 0, options = (null)}\n\t5 : <CTTextTab: 0x79b88180>{location = 168, alignment = 0, options = (null)}\n\t6 : <CTTextTab: 0x79b881b0>{location = 196, alignment = 0, options = (null)}\n\t7 : <CTTextTab: 0x79b881e0>{location = 224, alignment = 0, options = (null)}\n\t8 : <CTTextTab: 0x79b88210>{location = 252, alignment = 0, options = (null)}\n\t9 : <CTTextTab: 0x79b88240>{location = 280, alignment = 0, options = (null)}\n\t10 : <CTTextTab: 0x79b88270>{location = 308, alignment = 0, options = (null)}\n\t11 : <CTTextTab: 0x79b882a0>{location = 336, alignment = 0, options = (null)}\n)}}";
}

@YauzZ
Copy link

YauzZ commented Jul 8, 2016

I have same crash in ios 9.0.2.

stack print :

Thread 4 (crashed)
0 CoreText!TLine::FindRunWithCharIndex(long) const + 0x38
Found by: given as instruction pointer in context
1 CoreText!TLine::CopyStringRange(TLine const&, CFRange) + 0xdc
Found by: previous frame's frame pointer
2 CoreText!TLine::CopyStringRange(TLine const&, CFRange) + 0xdc
Found by: previous frame's frame pointer
3 CoreText!TTypesetter::FillLine(std::__1::tuple*, unsigned int, unsigned char> const&, TLine&, CFRange, double, double) + 0x28
Found by: previous frame's frame pointer
4 CoreText!CTTypesetterCreateLine + 0xac
Found by: previous frame's frame pointer
5 UIFoundation!-[NSATSLineFragment layoutForStartingGlyphAtIndex:characterIndex:minPosition:maxPosition:lineFragmentRect:] + 0x814
Found by: previous frame's frame pointer
6 UIFoundation!-[NSATSTypesetter _layoutLineFragmentStartingWithGlyphAtIndex:characterIndex:atPoint:renderingContext:] + 0x938
Found by: previous frame's frame pointer
7 UIFoundation!-[NSATSTypesetter layoutParagraphAtPoint:] + 0x9c
Found by: previous frame's frame pointer
8 UIFoundation!-[NSTypesetter _layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:maxCharacterIndex:nextGlyphIndex:nextCharacterIndex:] + 0xbd8
Found by: previous frame's frame pointer
9 UIFoundation!-[NSTypesetter layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments:] + 0xf0
Found by: previous frame's frame pointer
10 UIFoundation!-[NSATSTypesetter layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments:] + 0x1bc
Found by: previous frame's frame pointer
11 UIFoundation!-[NSLayoutManager(NSPrivate) _fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:] + 0x410
Found by: previous frame's frame pointer
12 UIFoundation!-[NSLayoutManager(NSPrivate) _fillLayoutHoleAtIndex:desiredNumberOfLines:] + 0xc0
Found by: previous frame's frame pointer
13 UIFoundation!-[NSLayoutManager(NSPrivate) _markSelfAsDirtyForBackgroundLayout:] + 0x154
Found by: previous frame's frame pointer
14 UIFoundation!-[NSLayoutManager setTextStorage:] + 0x294
Found by: previous frame's frame pointer
15 UIFoundation!-[NSTextStorage addLayoutManager:] + 0x60
Found by: previous frame's frame pointer

@DaiYue
Copy link

DaiYue commented Jul 8, 2016

Set preferredMaxLayoutWidth to a non-zero value fixed it for me.

@YauzZ
Copy link

YauzZ commented Oct 17, 2016

use MainQueue to sloved my question.
i guess the reasion about asscoate object in mutilthreads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants