Crash on Linux Mint loading custom font

I’m seeing a crash on Linux Mint, running from CLion.

Using Clang 10 to compile.

The line causing the crash is

    static const juce::Typeface::Ptr rubikMedium = juce::Typeface::createSystemTypefaceFor (BinaryData::RubikMedium_ttf, BinaryData::RubikMedium_ttfSize);

Could it be due to the static assignment?

Any ideas on what might be causing this?

Stack trace:

juce::CharPointer_UTF8::isEmpty juce_CharPointer_UTF8.h:73
juce::String::isEmpty juce_String.h:310
juce::StringPool::getPooledString juce_StringPool.cpp:133
juce::Identifier::Identifier juce_Identifier.cpp:46
juce::XmlElement::createTextElement juce_XmlElement.cpp:955
juce::XmlDocument::readChildElements juce_XmlDocument.cpp:650
juce::XmlDocument::readNextElement juce_XmlDocument.cpp:441
juce::XmlDocument::readChildElements juce_XmlDocument.cpp:550
juce::XmlDocument::readNextElement juce_XmlDocument.cpp:441
juce::XmlDocument::parseDocumentElement juce_XmlDocument.cpp:219
juce::XmlDocument::getDocumentElement juce_XmlDocument.cpp:138
juce::parseXML juce_XmlDocument.cpp:48
juce::findFontsConfFile juce_linux_Fonts.cpp:35
juce::FTTypefaceList::getDefaultFontDirectories juce_linux_Fonts.cpp:50
juce::FTTypefaceList::FTTypefaceList juce_freetype_Fonts.cpp:92
juce::SingletonHolder<juce::FTTypefaceList, juce::DummyCriticalSection, false>::getWithoutChecking juce_Singleton.h:106
juce::FTTypefaceList::getInstance juce_freetype_Fonts.cpp:227
juce::FreeTypeTypeface::FreeTypeTypeface juce_freetype_Fonts.cpp:299
juce::Typeface::createSystemTypefaceFor juce_linux_Fonts.cpp:88
__cxx_global_var_init.169(void) CustomLookAndFeel.h:46
_GLOBAL__sub_I_PluginProcessor.cpp IDs.h:60
__libc_csu_init 0x0000000000bbdefd
__libc_start_main 0x00007ff578361040
_start 0x0000000000450a1e

This looks like it could be an order of initialization issue, although I’m not sure what the cause could be (the StringPool should always be constructed on first use, so it’s unlikely to be that…).

Have you tried building/running with address sanitizer? Hopefully asan will provide some more descriptive output.

1 Like

It was order of initialisation - I changed the initialisation from static to the LnF constructor and it no longer crashes. Thanks!