Fix: Memory leak in ICUParagraphLayout::NextLine() (#11895)

This function calls icu::BreakIterator::createLineInstance() but does not clean up after it.

Instead use a static instance that is cloned (for thread-safety) and deleted as necessary.

(cherry picked from commit 6d276698b6)
This commit is contained in:
Peter Nelson
2024-01-27 20:13:42 +00:00
committed by Jonathan G Rennison
parent 5b052ff91a
commit 009fea0e14
5 changed files with 45 additions and 4 deletions

View File

@@ -337,6 +337,16 @@ Font *Layouter::GetFont(FontSize size, TextColour colour)
return fonts[size][colour].get();
}
/**
* Perform initialization of layout engine.
*/
void Layouter::Initialize()
{
#if defined(WITH_ICU_I18N) && defined(WITH_HARFBUZZ)
ICUParagraphLayoutFactory::InitializeLayouter();
#endif /* WITH_ICU_I18N && WITH_HARFBUZZ */
}
/**
* Reset cached font information.
* @param size Font size to reset.