STULabel icon indicating copy to clipboard operation
STULabel copied to clipboard

EXC_BREAKPOINT - stu_label::FontFaceGlyphBoundsCache::boundingRect

Open oMystique opened this issue 3 years ago • 2 comments

Faced such an error. It would be nice to find a solution to this problem. It is not possible to determine the case, I have never shown it. However, users get it quite often (on different versions of iOS and smartphone models)

Crashed: Thread EXC_BREAKPOINT 0x0000000000000001 0 STULabel stu_label::FontFaceGlyphBoundsCache::boundingRect(double, stu::ArrayRef, CGPoint const*) + 3684 (Font.mm) 1 STULabel ThreadLocalAllocatorRef + 4 [inlined] (ThreadLocalAllocator.hpp:68) 2 STULabel ThreadLocalAllocatorRef + 4 [inlined] (ThreadLocalAllocator.hpp:69) 3 STULabel TempVector + 28 [inlined] (ThreadLocalAllocator.hpp:119) 4 STULabel TempVector + 28 [inlined] (ThreadLocalAllocator.hpp:122) 5 STULabel stu_label::FontFaceGlyphBoundsCache::boundingRect(double, stu::ArrayRef, CGPoint const*) + 96 (Font.mm:522) 6 STULabel stu_label::GlyphSpan::imageBoundsImpl(stu_label::GlyphRunRef, CFRange, stu_label::LocalGlyphBoundsCache&) + 64 (GlyphSpan.mm:47) 7 STULabel isEmpty + 0 [inlined] (Rect.hpp:339) 8 STULabel operator() + 48 [inlined] (TextFrameLine-ImageBounds.mm:185) 9 STULabel call<(lambda at /STULabel/Internal/TextFrameLine-ImageBounds.mm:180:5)> + 88 (FunctionRef.hpp:209) 10 STULabel stu_label::TextFrameLine::forEachCTLineSegment(stu_label::FlagsRequiringIndividualRunIteration, stu::FunctionRef<stu_label::ShouldStop (stu_label::TextLinePart, stu_label::CTLineXOffset, __CTLine const&, stu::Optional<stu_label::GlyphSpan>)>) const + 520 (TextFrameLine-GlyphSpanIteration.mm:37) 11 STULabel calculateLineGlyphPathBoundsLLO + 44 [inlined] (TextFrameLine-ImageBounds.mm:191) 12 STULabel calculateLineImageBoundsLLO + 108 [inlined] (TextFrameLine-ImageBounds.mm:219) 13 STULabel stu_label::TextFrameLine::calculateImageBoundsLLO(stu_label::ImageBoundsContext const&) const + 392 (TextFrameLine-ImageBounds.mm:472) 14 STULabel stu_label::TextFrame::calculateImageBounds(stu_label::TextFrameOrigin, stu_label::ImageBoundsContext const&) const + 352 (TextFrame.mm:380) 15 STULabel STUTextFrameGetImageBoundsForRange(STUTextFrame const*, STUTextFrameRange, CGPoint, double, STUTextFrameDrawingOptions const*, STUCancellationFlag const*) + 568 (STUTextFrame.mm) 16 STULabel inverseValue_f64 + 0 [inlined] (DisplayScaleRounding.hpp:68) 17 STULabel inverseValue + 0 [inlined] (DisplayScaleRounding.hpp:54) 18 STULabel stu_label::labelTextFrameRenderInfo(STUTextFrame const*, stu_label::LabelTextFrameInfo const&, CGPoint const&, stu_label::LabelParameters const&, bool, bool, STUCancellationFlag const*) + 224 (LabelRendering.mm:130) 19 STULabel stu_label::LabelLayer::display() + 588 (STULabelLayer.mm:1155) 20 QuartzCore CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 416 21 QuartzCore CA::Context::commit_transaction(CA::Transaction*, double, double*) + 416 22 QuartzCore CA::Transaction::commit() + 728 23 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92 24 CoreFoundation CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 32 25 CoreFoundation __CFRunLoopDoObservers + 604 26 CoreFoundation __CFRunLoopRun + 960 27 CoreFoundation CFRunLoopRunSpecific + 572 28 GraphicsServices GSEventRunModal + 160 29 UIKitCore -[UIApplication _run] + 1052 30 UIKitCore UIApplicationMain + 164 31 MyApplication main + 88 (main.m:14) 32 libdyld.dylib start + 4

oMystique avatar Jun 08 '21 15:06 oMystique

To debug this I need a sample that reproduces this issue.

stephan-tolksdorf avatar Aug 12 '23 15:08 stephan-tolksdorf

@stephan-tolksdorf Thanks for the useful library.

I encountered the same crash yesterday.

iOS 17.2.1, iPhone 15 Pro, STULabel 0.8.10

Crashed: com.apple.main-thread
0  STULabel                       0xd354 stu_label::FontFaceGlyphBoundsCache::boundingRect(double, stu::ArrayRef<unsigned short const>, CGPoint const*) + 633 (Font.mm:633)
1  STULabel                       0xc488 stu_label::FontFaceGlyphBoundsCache::boundingRect(double, stu::ArrayRef<unsigned short const>, CGPoint const*) + 68 (ThreadLocalAllocator.hpp:68)
2  STULabel                       0xe544 stu_label::GlyphSpan::imageBoundsImpl(stu_label::GlyphRunRef, CFRange, stu_label::LocalGlyphBoundsCache&) + 49 (GlyphSpan.mm:49)
3  STULabel                       0x4ae18 stu_label::ShouldStop stu::detail::FunctionRefBase<stu_label::ShouldStop (stu_label::TextLinePart, stu_label::CTLineXOffset, __CTLine const&, stu::Optional<stu_label::GlyphSpan>)>::call<stu_label::calculateLineGlyphPathBoundsLLO(stu_label::TextFrameLine const&, STUCancellationFlag const&, stu_label::LocalGlyphBoundsCache&)::$_3>(void*, stu_label::TextLinePart, stu_label::CTLineXOffset, __CTLine const&, stu::Optional<stu_label::GlyphSpan>) + 339 (Rect.hpp:339)
4  STULabel                       0x478f8 stu_label::TextFrameLine::forEachCTLineSegment(stu_label::FlagsRequiringIndividualRunIteration, stu::FunctionRef<stu_label::ShouldStop (stu_label::TextLinePart, stu_label::CTLineXOffset, __CTLine const&, stu::Optional<stu_label::GlyphSpan>)>) const + 199 (FunctionRef.hpp:199)
5  STULabel                       0x4a4cc stu_label::calculateLineImageBoundsLLO(stu_label::TextFrameLine const&, stu_label::ImageBoundsContext const&) + 515 (TextFrame.hpp:515)
6  STULabel                       0x49e98 stu_label::TextFrameLine::calculateImageBoundsLLO(stu_label::ImageBoundsContext const&) const + 474 (TextFrameLine-ImageBounds.mm:474)
7  STULabel                       0x3c2fc stu_label::TextFrame::calculateImageBounds(stu_label::TextFrameOrigin, stu_label::ImageBoundsContext const&) const + 380 (TextFrame.mm:380)
8  STULabel                       0x337b8 STUTextFrameGetImageBoundsForRange(STUTextFrame const*, STUTextFrameRange, CGPoint, double, STUTextFrameDrawingOptions const*, STUCancellationFlag const*) + 496 (STUTextFrame.mm:496)
9  STULabel                       0x10a0c stu_label::labelTextFrameRenderInfo(STUTextFrame const*, stu_label::LabelTextFrameInfo const&, CGPoint const&, stu_label::LabelParameters const&, bool, bool, STUCancellationFlag const*) + 68 (DisplayScaleRounding.hpp:68)
10 STULabel                       0x22de8 stu_label::LabelLayer::display() + 1161 (STULabelLayer.mm:1161)
11 QuartzCore                     0x66e54 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 412
12 QuartzCore                     0x6d278 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 464
13 QuartzCore                     0x66574 CA::Transaction::commit() + 648
14 QuartzCore                     0x6621c CA::Transaction::flush_as_runloop_observer(bool) + 88
15 UIKitCore                      0xaa974 _UIApplicationFlushCATransaction + 52
16 UIKitCore                      0xaa48c _UIUpdateSequenceRun + 84
17 UIKitCore                      0xa9b7c schedulerStepScheduledMainSection + 144
18 UIKitCore                      0xa9c38 runloopSourceCallback + 92
19 CoreFoundation                 0x3731c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
20 CoreFoundation                 0x36598 __CFRunLoopDoSource0 + 176
21 CoreFoundation                 0x34d4c __CFRunLoopDoSources0 + 244
22 CoreFoundation                 0x33a88 __CFRunLoopRun + 828
23 CoreFoundation                 0x33668 CFRunLoopRunSpecific + 608
24 GraphicsServices               0x35ec GSEventRunModal + 164
25 UIKitCore                      0x22c2b4 -[UIApplication _run] + 888
26 UIKitCore                      0x22b8f0 UIApplicationMain + 340
27 UIKitCore                      0x4559c8 __swift_destroy_boxed_opaque_existential_1Tm + 12220

Here is how to reproduce it in my environment.


No crash

▶︎

\u25B6\uFE0E

Crashing

︎▶︎

\uFE0E\u25B6\uFE0E


It seems that FontFaceGlyphBoundsCache::boundingRect crashes when "Variation Selectors" are inserted at the beginning.

Let me know if you need any other information.

hanawat avatar Jan 07 '24 03:01 hanawat

@stephan-tolksdorf Hope you see this thread.

hanawat avatar Feb 01 '24 06:02 hanawat