i’ve discovered that if i serialize a font with Typeface serialize method, and then load the typeface in the application, build a font pointer, then pass the created *fontPointer to some TextEditors with setFont(), then i get some leaks not in the first component, but instead after creating some of them dynamically:
juce_application.exe!wcscmp(const wchar_t * src=0x00ed2fc8, const wchar_t * dst=0x000001fc) Line 52 + 0x9 bytes
juce_application.exe!juce::String::operator!=(const juce::String & other={...}) Line 783 + 0x23 bytes
juce_application.exe!juce::FontDCHolder::loadFont(const juce::String & fontName_={...}, const bool bold_=true, const bool italic_=true, const int size_=0) Line 274 + 0xf bytes
juce_application.exe!juce::Typeface::findAndAddSystemGlyph(wchar_t character=L'i') Line 539 + 0x29 bytes
juce_application.exe!juce::Typeface::getGlyph(const wchar_t character=L'i') Line 303
juce_application.exe!juce::Typeface::getOutlineForGlyph(const wchar_t character=L'i') Line 271 + 0xd bytes
juce_application.exe!juce::FontGlyphAlphaMap::generate(juce::Typeface * const face=0x00f96a80, const wchar_t character_=L'i', const float fontHeight=10.000000, const float fontHorizontalScale=1.0000000) Line 175 + 0xd bytes
juce_application.exe!juce::GlyphCache::getGlyphFor(juce::Typeface * const typeface=0x00f96a80, const float fontHeight=10.000000, const float fontHorizontalScale=1.0000000, const wchar_t character=L'i') Line 265
juce_application.exe!juce::PositionedGlyph::draw(juce::Graphics & g={...}) Line 328 + 0x35 bytes
juce_application.exe!juce::GlyphArrangement::draw(juce::Graphics & g={...}) Line 1148
juce_application.exe!juce::Graphics::drawSingleLineText(const juce::String & text={...}, const int startX=0, const int baselineY=8) Line 221
juce_application.exe!juce::TextEditorIterator::draw(juce::Graphics & g={...}, const juce::UniformTextSection * & lastSection=0x010784a0) Line 500 + 0x80 bytes
juce_application.exe!juce::TextEditor::drawContent(juce::Graphics & g={...}) Line 1471
juce_application.exe!juce::TextHolderComponent::paint(juce::Graphics & g={...}) Line 775
juce_application.exe!juce::Component::paintEntireComponent(juce::Graphics & originalContext={...}) Line 1613 + 0x13 bytes
some other i get, randomly selecting and opening a new TextEditor, assigning this font (but a previously created TextEditor is showing the text with the font correctly):
juce_application.exe!juce::Array<void *,juce::DummyCriticalSection>::getUnchecked(const int index=0) Line 250 + 0x8 bytes
juce_application.exe!juce::Typeface::getGlyph(const wchar_t character=L'v') Line 288 + 0xf bytes
juce_application.exe!juce::Typeface::getOutlineForGlyph(const wchar_t character=L'v') Line 271 + 0xd bytes
juce_application.exe!juce::FontGlyphAlphaMap::generate(juce::Typeface * const face=0x00f96a80, const wchar_t character_=L'v', const float fontHeight=10.000000, const float fontHorizontalScale=1.0000000) Line 175 + 0xd bytes
juce_application.exe!juce::GlyphCache::getGlyphFor(juce::Typeface * const typeface=0x00f96a80, const float fontHeight=10.000000, const float fontHorizontalScale=1.0000000, const wchar_t character=L'v') Line 265
juce_application.exe!juce::PositionedGlyph::draw(juce::Graphics & g={...}) Line 328 + 0x35 bytes
juce_application.exe!juce::GlyphArrangement::draw(juce::Graphics & g={...}) Line 1148
juce_application.exe!juce::Graphics::drawSingleLineText(const juce::String & text={...}, const int startX=0, const int baselineY=8) Line 221
juce_application.exe!ejuce::TextEditorIterator::draw(juce::Graphics & g={...}, const ejuce::UniformTextSection * & lastSection=0x00fb9120) Line 492 + 0x80 bytes
juce_application.exe!ejuce::TextEditor::drawContent(juce::Graphics & g={...}) Line 1463
juce_application.exe!ejuce::TextHolderComponent::paint(juce::Graphics & g={...}) Line 767
juce_application.exe!juce::Component::paintEntireComponent(juce::Graphics & originalContext={...}) Line 1613 + 0x13 bytes
the font is clearly visible with some text editors, opening some others, or changing text on the first then the leak sleaks into.
i’m doing nothing more than:
[code]// global singleton config constructor
MemoryInputStream fontStream (Resource::myfont,Resource::myfont_size, false);
Typeface* typeFace = new Typeface (fontStream);
editorFont = new Font (*typeFace);
editorFont->setHeight (10.0f);
// global singleton config destructor
if (editorFont)
delete editorFont;
// then when user selects some i do:
addAndMakeVisible(debugOutput = new TextEditor());
debugOutput->setColours (Colours::lightgreen, Colours::black, Colours::palegreen);
debugOutput->setMultiLine (true, false);
debugOutput->setCaretVisible (true);
debugOutput->setFont (*(GlobalConfig::getInstance()->editorFont));
debugOutput->setText (T(""));
[/code]
if i use the default Font, without creating one from typeface those crashes don’t occurr. i’m doing something silly ?