# Occasional glyph crash

**URL:** <https://forum.juce.com/t/occasional-glyph-crash/33115>\
**Category:** General JUCE discussion\
**Created:** [April 29, 2019, 1:08pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115 "2019-04-29T13:08:38Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Achder](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/achder/32/5897_2.png) [@Achder](https://forum.juce.com/u/Achder)\
**Post date:** [April 29, 2019, 1:08pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/1 "2019-04-29T13:08:38Z")

</div>

Hey,  
I very rarely get a crash with the following stack trace. I know this is not much information, but maybe somebody has an idea? The problem seems to be a textlayouts draw function. But this is very hard to debug since it happens very rarely and the trace is so strange with the glyph stuff. We are using a font that is included in the binary data. Could there be a problem with that? No matter what I do, I can’t reproduce it.

```
0 Nylon 0x0000000126b632b1 _ZN4juceL11handleCrashEi + 65
1 libsystem_platform.dylib 0x00007fff67b4ab3d _sigtramp + 29
2 ??? 0x0000000000000000 0x0 + 0
3 libFontParser.dylib 0x00007fff38bef27b _ZNK17TSFNTOpenTypeFont10GetCFFDataEim + 53
4 libFontParser.dylib 0x00007fff38be39f8 _ZNK13TOpenTypeFont13GetCharStringEt + 90
5 libFontParser.dylib 0x00007fff38bdadd8 _ZNK17TType1FontHandler12ParseOutlineEtR22TType1RenderingContext + 52
6 libFontParser.dylib 0x00007fff38bdad8e _ZNK32TType1FontType2CharStringHandler12ParseOutlineEtR22TType1RenderingContext + 14
7 libFontParser.dylib 0x00007fff38c2ae9f _ZNK32TType1FontType2CharStringHandler14GetOutlinePathEtRK18TGlyphOutlineBatchPb + 269
8 libFontParser.dylib 0x00007fff38bc4d93 FPFontCopyGlyphPath + 371
9 CoreGraphics 0x00007fff3ab75bd3 CGFontCreateGlyphPath + 42
10 CoreGraphics 0x00007fff3ab75991 CGFontCreateGlyphBitmapWithDilation + 787
11 CoreGraphics 0x00007fff3ab75395 _ZN14CGGlyphBuilder22create_missing_bitmapsEPK17CGGlyphIdentifiermPPK13CGGlyphBitmap + 169
12 CoreGraphics 0x00007fff3ab74f39 _ZN14CGGlyphBuilder18lock_glyph_bitmapsEPK17CGGlyphIdentifiermPPK13CGGlyphBitmap + 165
13 CoreGraphics 0x00007fff3ab74d5a render_glyphs + 184
14 CoreGraphics 0x00007fff3ab74560 draw_glyph_bitmaps + 1071
15 CoreGraphics 0x00007fff3ab740a3 ripc_DrawGlyphs + 1454
16 CoreGraphics 0x00007fff3ab73757 CGContextDelegateDrawGlyphs + 906
17 AppKit 0x00007fff37f91090 __backing_store_DrawGlyphs_block_invoke + 48
18 AppKit 0x00007fff37e6d548 backing_store_delegate + 875
19 AppKit 0x00007fff38192789 backing_store_DrawGlyphs.llvm.6249430987493125948 + 1500
20 CoreGraphics 0x00007fff3ab73757 CGContextDelegateDrawGlyphs + 906
21 CoreGraphics 0x00007fff3aed746b draw_glyphs + 712
22 CoreGraphics 0x00007fff3aed713d CGContextShowGlyphs + 494
23 Nylon 0x0000000126bb196c _ZN4juce19CoreGraphicsContext9drawGlyphEiRKNS_15AffineTransformE + 492
24 Nylon 0x0000000126bdf74d _ZNK4juce10TextLayout4drawERNS_8GraphicsENS_9RectangleIfEE + 637
25 Nylon 0x0000000126c373e9 _ZN4juce9Component25paintComponentAndChildrenERNS_8GraphicsE + 137
26 Nylon 0x0000000126c3779d _ZN4juce9Component25paintComponentAndChildrenERNS_8GraphicsE + 1085
27 Nylon 0x0000000126c3779d _ZN4juce9Component25paintComponentAndChildrenERNS_8GraphicsE + 1085
28 Nylon 0x0000000126c3779d _ZN4juce9Component25paintComponentAndChildrenERNS_8GraphicsE + 1085
29 Nylon 0x0000000126c3779d _ZN4juce9Component25paintComponentAndChildrenERNS_8GraphicsE + 1085
30 Nylon 0x0000000126c3779d _ZN4juce9Component25paintComponentAndChildrenERNS_8GraphicsE + 1085
31 Nylon 0x0000000126c3779d _ZN4juce9Component25paintComponentAndChildrenERNS_8GraphicsE + 1085
32 Nylon 0x0000000126c3779d _ZN4juce9Component25paintComponentAndChildrenERNS_8GraphicsE + 1085
33 Nylon 0x0000000126c3779d _ZN4juce9Component25paintComponentAndChildrenERNS_8GraphicsE + 1085
34 Nylon 0x0000000126c3779d _ZN4juce9Component25paintComponentAndChildrenERNS_8GraphicsE + 1085
35 Nylon 0x0000000126c3779d _ZN4juce9Component25paintComponentAndChildrenERNS_8GraphicsE + 1085
36 Nylon 0x0000000126c60506 _ZN4juce13ComponentPeer11handlePaintERNS_23LowLevelGraphicsContextE + 310
37 Nylon 0x0000000126c59d10 _ZN4juce15JuceNSViewClass8drawRectEP11objc_objectP13objc_selector6CGRect + 480
38 AppKit 0x00007fff37d8ac29 _NSViewDrawRect + 66
39 AppKit 0x00007fff37d75a22 -[NSView _drawRect:clip:] + 1745
40 AppKit 0x00007fff37d738e6 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4808
41 AppKit 0x00007fff37d73226 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 3080
42 AppKit 0x00007fff37d73226 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 3080
43 AppKit 0x00007fff37d725f8 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 65
44 AppKit 0x00007fff37d6ff2a -[NSView _oldDisplayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 1887
45 AppKit 0x00007fff37d6f569 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 253
46 AppKit 0x00007fff37d6c152 -[NSView displayIfNeeded] + 1300
47 AppKit 0x00007fff37d68ee8 -[NSWindow displayIfNeeded] + 283
48 AppKit 0x00007fff37d68d27 __NSWindowGetDisplayCycleObserverForDisplay_block_invoke + 722
49 AppKit 0x00007fff37d63e2a NSDisplayCycleObserverInvoke + 170
50 AppKit 0x00007fff37d6399f NSDisplayCycleFlush + 1073
51 QuartzCore 0x00007fff456c425b _ZN2CA11Transaction19run_commit_handlersE18CATransactionPhase + 49
52 QuartzCore 0x00007fff456c3c22 _ZN2CA11Transaction6commitEv + 186
53 AppKit 0x00007fff37d63305 __65+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayRefresh]_block_invoke + 274
54 CoreFoundation 0x00007fff3a76c8ed __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
55 CoreFoundation 0x00007fff3a76c822 __CFRunLoopDoObservers + 452
56 CoreFoundation 0x00007fff3a70e345 __CFRunLoopRun + 1166
57 CoreFoundation 0x00007fff3a70dc64 CFRunLoopRunSpecific + 463
58 HIToolbox 0x00007fff399a4ab5 RunCurrentEventLoopInMode + 293
59 HIToolbox 0x00007fff399a47eb ReceiveNextEventCommon + 618
60 HIToolbox 0x00007fff399a4568 _BlockUntilNextEventMatchingListInModeWithFilter + 64
61 AppKit 0x00007fff37c5f363 _DPSNextEvent + 997
62 AppKit 0x00007fff37c5e102 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1362
63 AppKit 0x00007fff37c58165 -[NSApplication run] + 699
64 Foundation 0x00007fff3cb040c5 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 1123
65 Foundation 0x00007fff3cb0bc6a -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 131
66 BitwigStudioEngine 0x000000010b536cb3 main + 8099
67 libdyld.dylib 0x00007fff6795fed9 start + 1
68 ??? 0x0000000000000003 0x0 + 3

```

---

<div class="post-metadata">

**Author:** ![RolandMR](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rolandmr/32/641_2.png) [@RolandMR](https://forum.juce.com/u/RolandMR)\
**Post date:** [April 29, 2019, 1:19pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/2 "2019-04-29T13:19:43Z")

</div>

Yes, we are struggling with this bug too. I’m pretty sure it is caused by fonts in custom data. I’ve spent a lot of time digging into the juce code and I can’t see anything wrong. I think the bug was introduced in a recent version of macOS.

My only advice is to create your custom Typeface only once, maybe in a singleton. The more Typefaces you create, the more likely you are to get a crash.

Other related threads:

> [@OSX font corruption](https://forum.juce.com/t/osx-font-corruption/32924):
>
> I am making a plugin, which loads a TTF font from a JUCE BinaryResource. I am loading this font inside the “PluginEditor” class, the following way: defaultTypefacePtr = Typeface::createSystemTypefaceFor(BinaryData::Roboto\_Light\_ttf, BinaryData::Roboto\_Light\_ttfSize); In other words: This line is run every time I open the plugin window. My problem: The font gets corrupted, after opening the plugin window several times inside a DAW. By corrupted I mean that letters are missing and that I even …

> [@Typeface::createSystemTypefaceFor Leaks on Mac](https://forum.juce.com/t/typeface-createsystemtypefacefor-leaks-on-mac/32760):
>
> I’m seeing what are apparently memory leaks with Typeface::createSystemTypefaceFor() on specifically Mac. We were encountering behavior where scrolling through about a hundred presets and resetting to our default empty preset would increase baseline RAM usage by 20MB (instead of the initial RAM usage). This behavior wasn’t appearing on Windows. After opening up Instruments\>Allocations and looking at the heap, we were seeing a lot of allocated memory that was created per-preset by Typeface::cre…

---

<div class="post-metadata">

**Author:** ![RolandMR](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rolandmr/32/641_2.png) [@RolandMR](https://forum.juce.com/u/RolandMR)\
**Post date:** [April 29, 2019, 2:32pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/3 "2019-04-29T14:32:50Z")

</div>

Can you build and run my test app CrazyFonts, found here: [https://github.com/FigBug/juce\_bugs/tree/master/CrazyFonts](https://github.com/FigBug/juce_bugs/tree/master/CrazyFonts) and let me know the results. Make sure the window is showing and the screensaver doesn’t come on so that it’s continually painting.

---

<div class="post-metadata">

**Author:** ![Achder](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/achder/32/5897_2.png) [@Achder](https://forum.juce.com/u/Achder)\
**Post date:** [April 29, 2019, 3:11pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/4 "2019-04-29T15:11:57Z")

</div>

Ok, I did. I see lots of crazy coloured fonts. What now? There’s no output. What results should I post?

---

<div class="post-metadata">

**Author:** ![RolandMR](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rolandmr/32/641_2.png) [@RolandMR](https://forum.juce.com/u/RolandMR)\
**Post date:** [April 29, 2019, 3:19pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/5 "2019-04-29T15:19:02Z")

</div>

Let it run for a few hours when you don’t need your machine. How much memory is it using / how much memory does the kernel use? Does the painting get slower and slower? Does it eventually crash / lock up / crash your machine?

On my Trash Can Mac Pro I eventually get a Kernel Panic:

```auto
Anonymous UUID: E2963E78-DB30-EBDE-59C8-3A0656C5B180

Sun Apr 21 13:17:43 2019

***Panic Report***
panic(cpu 2 caller 0xffffff8010c3176c): "trying to interlock destroyed mutex (0xffffff8078e71000)"@/BuildRoot/Library/Caches/com.apple.xbs/Sources/xnu/xnu-4903.251.3/osfmk/i386/locks_i386.c:2749

```

On my MacBook Pro it just gets slower and slower and the Kernel Memory Usage gets up to about 5 GB.

My goal is to reproduce the crash you are seeing above, so far I can’t do it. But I am getting other weird behaviour.

---

<div class="post-metadata">

**Author:** ![Achder](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/achder/32/5897_2.png) [@Achder](https://forum.juce.com/u/Achder)\
**Post date:** [July 4, 2019, 1:20pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/6 "2019-07-04T13:20:23Z")

</div>

Ok so we are getting the crash trace from my first post about once a week.  
I’m running the program @RolandMR linked for a while now. It never crashes but is regularly hangs for a variable period of time.

We are also seeing missing glyphs instead of crashes from time to time.  
We are using a combination of AttributedString and Textlayout, if that helps.

I’d be very happy if this can somehow be fixed.

---

<div class="post-metadata">

**Author:** ![RolandMR](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rolandmr/32/641_2.png) [@RolandMR](https://forum.juce.com/u/RolandMR)\
**Post date:** [July 4, 2019, 2:40pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/7 "2019-07-04T14:40:09Z")

</div>

I’m still trying to find a reliable way to reproduce this bug. This is our #1 mac crash, if anybody has any ideas on how to fix or work around I’d be very interested to hear.

What embedded fonts are you using? I’m wondering if there is some way to write them to disk, install them, and load them as regular fonts , to work around?

---

<div class="post-metadata">

**Author:** ![Achder](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/achder/32/5897_2.png) [@Achder](https://forum.juce.com/u/Achder)\
**Post date:** [July 4, 2019, 3:45pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/8 "2019-07-04T15:45:15Z")

</div>

We are using Apercu cuts as .otf.  
Installing fonts to a users computer sounds like it would cause some legal issues, since we bought that font.

---

<div class="post-metadata">

**Author:** ![Achder](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/achder/32/5897_2.png) [@Achder](https://forum.juce.com/u/Achder)\
**Post date:** [July 4, 2019, 5:27pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/9 "2019-07-04T17:27:56Z")

</div>

Have you ever tried your test program as a plugin instead of a standalone version?

---

<div class="post-metadata">

**Author:** ![RolandMR](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rolandmr/32/641_2.png) [@RolandMR](https://forum.juce.com/u/RolandMR)\
**Post date:** [July 4, 2019, 6:11pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/10 "2019-07-04T18:11:55Z")

</div>

No, I haven’t tried that. Might be worth trying. But I am seeing these crashes in our App as well. Maybe it’s a combination of juce based host / plugin that causes the issue? What host are you using?

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [October 1, 2019, 1:54pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/11 "2019-10-01T13:54:54Z")

</div>

We also have occasional crashes deep in OSX text layout code we cannot explain!

---

<div class="post-metadata">

**Author:** ![Achder](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/achder/32/5897_2.png) [@Achder](https://forum.juce.com/u/Achder)\
**Post date:** [October 17, 2019, 4:22pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/12 "2019-10-17T16:22:05Z")

</div>

Ok, so we have this new stacktrace from a debug run:

```auto
__pthread_kill 0x00007fff7481f2c6
pthread_kill 0x00007fff748dabf1
abort 0x00007fff747896a6
malloc_vreport 0x00007fff74898077
malloc_zone_error 0x00007fff748b0e0d
tiny_malloc_from_free_list 0x00007fff74890f17
tiny_malloc_should_clear 0x00007fff7489043b
szone_malloc_should_clear 0x00007fff7489020f
malloc_zone_malloc 0x00007fff7488ec99
CFBasicHashCreateCopy 0x00007fff48784117
CFDictionaryCreateMutableCopy 0x00007fff48783e61
TCFMutableDictionary::TCFMutableDictionary(__CFDictionary const*, long) 0x00007fff4a38405a
CTFontDescriptorCreateCopyWithAttributes 0x00007fff4a3cd2c1
CTFontCreateCopyWithAttributes 0x00007fff4a3cd1dc
TAttributes::CopyOfFontWithLigatureSetting(__CTFont const*, LigatureSetting) 0x00007fff4a3ebe21
TAttributes::ApplyFont( __CFDictionary const*,__ CTFont const*, void const**) 0x00007fff4a3b5c16
TAttributes::TAttributes(__CFDictionary const*) 0x00007fff4a3b5947
TTypesetterAttrString::Initialize(__CFAttributedString const*) 0x00007fff4a3c260c
TTypesetterAttrString::TTypesetterAttrString( __CFAttributedString const*,__ CFDictionary const*) 0x00007fff4a3c2379
CTLineCreateWithAttributedString 0x00007fff4a3c21ca
juce::OSXTypeface::getGlyphPositions(juce::String const&, juce::Array<int, juce::DummyCriticalSection, 0>&, juce::Array<float, juce::DummyCriticalSection, 0>&) juce_mac_Fonts.mm:609
juce::Font::getGlyphPositions(juce::String const&, juce::Array<int, juce::DummyCriticalSection, 0>&, juce::Array<float, juce::DummyCriticalSection, 0>&) const juce_Font.cpp:649
juce::GlyphArrangement::addCurtailedLineOfText(juce::Font const&, juce::String const&, float, float, float, bool) juce_GlyphArrangement.cpp:152
juce::GlyphArrangement::addLineOfText(juce::Font const&, juce::String const&, float, float) juce_GlyphArrangement.cpp:141
juce::GlyphArrangement::addFittedText(juce::Font const&, juce::String const&, float, float, float, float, juce::Justification, int, float) juce_GlyphArrangement.cpp:324
juce::Graphics::drawFittedText(juce::String const&, juce::Rectangle<int>, juce::Justification, int, float) const juce_GraphicsContext.cpp:326
juce::LookAndFeel_V2::drawLabel(juce::Graphics&, juce::Label&) juce_LookAndFeel_V2.cpp:1248
juce::Label::paint(juce::Graphics&) juce_Label.cpp:336
juce::Component::paintComponentAndChildren(juce::Graphics&) juce_Component.cpp:1905
juce::Component::paintEntireComponent(juce::Graphics&, bool) juce_Component.cpp:2008
juce::Component::paintWithinParentContext(juce::Graphics&) juce_Component.cpp:1889
juce::Component::paintComponentAndChildren(juce::Graphics&) juce_Component.cpp:1950
juce::Component::paintEntireComponent(juce::Graphics&, bool) juce_Component.cpp:2008
juce::Component::paintWithinParentContext(juce::Graphics&) juce_Component.cpp:1889
juce::Component::paintComponentAndChildren(juce::Graphics&) juce_Component.cpp:1950
juce::Component::paintEntireComponent(juce::Graphics&, bool) juce_Component.cpp:2008
juce::Component::paintWithinParentContext(juce::Graphics&) juce_Component.cpp:1889
juce::Component::paintComponentAndChildren(juce::Graphics&) juce_Component.cpp:1950
juce::Component::paintEntireComponent(juce::Graphics&, bool) juce_Component.cpp:2008
juce::Component::paintWithinParentContext(juce::Graphics&) juce_Component.cpp:1889
juce::Component::paintComponentAndChildren(juce::Graphics&) juce_Component.cpp:1950
juce::Component::paintEntireComponent(juce::Graphics&, bool) juce_Component.cpp:2008
juce::Component::paintWithinParentContext(juce::Graphics&) juce_Component.cpp:1889
juce::Component::paintComponentAndChildren(juce::Graphics&) juce_Component.cpp:1950
juce::Component::paintEntireComponent(juce::Graphics&, bool) juce_Component.cpp:2008
juce::Component::paintWithinParentContext(juce::Graphics&) juce_Component.cpp:1889
juce::Component::paintComponentAndChildren(juce::Graphics&) juce_Component.cpp:1950
juce::Component::paintEntireComponent(juce::Graphics&, bool) juce_Component.cpp:2008
juce::Component::paintWithinParentContext(juce::Graphics&) juce_Component.cpp:1889
juce::Component::paintComponentAndChildren(juce::Graphics&) juce_Component.cpp:1950
juce::Component::paintEntireComponent(juce::Graphics&, bool) juce_Component.cpp:2008
juce::Component::paintWithinParentContext(juce::Graphics&) juce_Component.cpp:1889
juce::Component::paintComponentAndChildren(juce::Graphics&) juce_Component.cpp:1950
juce::Component::paintEntireComponent(juce::Graphics&, bool) juce_Component.cpp:2008
juce::Component::paintWithinParentContext(juce::Graphics&) juce_Component.cpp:1889
juce::Component::paintComponentAndChildren(juce::Graphics&) juce_Component.cpp:1950
juce::Component::paintEntireComponent(juce::Graphics&, bool) juce_Component.cpp:2008
juce::Component::paintWithinParentContext(juce::Graphics&) juce_Component.cpp:1889
juce::Component::paintComponentAndChildren(juce::Graphics&) juce_Component.cpp:1950
juce::Component::paintEntireComponent(juce::Graphics&, bool) juce_Component.cpp:2008
juce::Component::paintWithinParentContext(juce::Graphics&) juce_Component.cpp:1889
juce::Component::paintComponentAndChildren(juce::Graphics&) juce_Component.cpp:1950
juce::Component::paintEntireComponent(juce::Graphics&, bool) juce_Component.cpp:2008
juce::ComponentPeer::handlePaint(juce::LowLevelGraphicsContext&) juce_ComponentPeer.cpp:133
juce::NSViewComponentPeer::invokePaint(juce::LowLevelGraphicsContext&) juce_mac_NSViewComponentPeer.mm:958
juce::NSViewComponentPeer::drawRect(CGContext*, CGRect, float) juce_mac_NSViewComponentPeer.mm:861
juce::NSViewComponentPeer::drawRect(CGRect) juce_mac_NSViewComponentPeer.mm:852
juce::JuceNSViewClass::drawRect(objc_object*, objc_selector*, CGRect) juce_mac_NSViewComponentPeer.mm:1661
_NSViewDrawRect 0x00007fff45ea921e
-[NSView _drawRect:clip:] 0x00007fff45e9405e
-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 0x00007fff45e91fe1
-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 0x00007fff45e91798
-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 0x00007fff45e91798
-[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 0x00007fff45e90b8e
-[NSView _oldDisplayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] 0x00007fff45e8e490
-[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] 0x00007fff45e8dac9
-[NSView displayIfNeeded] 0x00007fff45e8a6be
-[NSWindow displayIfNeeded] 0x00007fff45e873ff
__NSWindowGetDisplayCycleObserverForDisplay_block_invoke 0x00007fff45e87240
NSDisplayCycleObserverInvoke 0x00007fff45e82334
NSDisplayCycleFlush 0x00007fff45e81eb4
CA::Transaction::run_commit_handlers(CATransactionPhase) 0x00007fff531f454d
CA::Transaction::commit() 0x00007fff531f3d26
__65+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayRefresh]_block_invoke 0x00007fff45e8184d
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ 0x00007fff487e7688
__CFRunLoopDoObservers 0x00007fff487e75bd
__CFRunLoopRun 0x00007fff48789ce0
CFRunLoopRunSpecific 0x00007fff4878961e
RunCurrentEventLoopInMode 0x00007fff479e81ab
ReceiveNextEventCommon 0x00007fff479e7ded
_BlockUntilNextEventMatchingListInModeWithFilter 0x00007fff479e7c76
_DPSNextEvent 0x00007fff45d8077d
-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] 0x00007fff45d7f46b
-[NSApplication run] 0x00007fff45d79588
-[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] 0x00007fff4aa7c828
-[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] 0x00007fff4aa84252
main 0x0000000108c4e042
start 0x00007fff746e43d5
start 0x00007fff746e43d5

```

Crashes on this line:

> <https://github.com/WeAreROLI/JUCE/blob/master/modules/juce_graphics/native/juce_mac_Fonts.mm#L609>

Maybe this is of any help.

---

<div class="post-metadata">

**Author:** ![cpenny](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/cpenny/32/4662_2.png) [@cpenny](https://forum.juce.com/u/cpenny)\
**Post date:** [October 17, 2019, 7:46pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/13 "2019-10-17T19:46:39Z")

</div>

I’ve been having this exact crash (same line number) a lot today. Interestingly, it only affected Debug builds, not Release builds. If I get it again, I’ll post the trace.

Edit: This is with a custom font (only loaded once when the app launches). MacOS 10.14.6. The crash happens when loading components with the custom font well after the app launched.

---

<div class="post-metadata">

**Author:** ![cpenny](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/cpenny/32/4662_2.png) [@cpenny](https://forum.juce.com/u/cpenny)\
**Post date:** [October 17, 2019, 8:13pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/14 "2019-10-17T20:13:15Z")

</div>

Just had this crash on iOS in the Simulator!

Same line as above:

> <https://github.com/WeAreROLI/JUCE/blob/master/modules/juce_graphics/native/juce_mac_Fonts.mm#L609>

This time it crashed on load. Only for debug builds.

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [October 17, 2019, 8:43pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/15 "2019-10-17T20:43:56Z")

</div>

I’ve had similar issues recently on a Standalone desktop app… using stock fonts.

Rail

---

<div class="post-metadata">

**Author:** ![midiculous](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/midiculous/32/582_2.png) [@midiculous](https://forum.juce.com/u/midiculous)\
**Post date:** [August 18, 2021, 12:15pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/16 "2021-08-18T12:15:58Z")

</div>

Any updates on this. I’ve had to give a few refunds on these crashes.

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [August 18, 2021, 12:47pm UTC](https://forum.juce.com/t/occasional-glyph-crash/33115/17 "2021-08-18T12:47:26Z")

</div>

We’ve fixed some macOS font rendering issues on the `develop` branch:

> <https://github.com/juce-framework/JUCE/commit/71bc1417>
>
> In particularly unfortunate cases, the fonts used for laying out and
> drawing an …AttributedString could end up differing, meaning that
> incorrect glyph indices would be used during rendering. The rendered
> text would end up using incorrect character symbols, making it
> unreadable.
> 
> The problem seems to be:
> \- The AttributedString fetched a typeface during the getOrCreateFont
> call in createCFAttributedString.
> \- Details of the typeface (its style and name) were stored into the
> CFAttributedString.
> \- During \`createLayout\`, a new \`Font\` object was created using the
> stored typeface name and style.
> \- When calling \`getTypeface\` on this new font, during rendering,
> a different typeface was returned.
> 
> The fix implemented here stores the Font objects used during the
> creating of the CFAttributedString, so that the fonts written to
> the juce::AttributedString are guaranteed to match the fonts used
> to compute the layout.
