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.
This commit is contained in:
Peter Nelson
2024-01-27 20:13:42 +00:00
committed by GitHub
parent 1df7b21ee3
commit 6d276698b6
5 changed files with 45 additions and 4 deletions

View File

@@ -37,6 +37,7 @@
#include "network/network_content_gui.h"
#include "newgrf_engine.h"
#include "core/backup_type.hpp"
#include "gfx_layout.h"
#include <stack>
#include <charconv>
@@ -1976,6 +1977,8 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
}
#endif /* WITH_ICU_I18N */
Layouter::Initialize();
/* Some lists need to be sorted again after a language change. */
ReconsiderGameScriptLanguage();
InitializeSortedCargoSpecs();