mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 14:02:59 +01:00
Ensure TTF system is torn down in correct order (#21707)
`TTFDispose` uses `gCurrentTTFFontSet` to deallocate internal resources. Having the function called after global variable got changed meant it tried to deallocate incorrect font and would subsequently call `FT_Done_Face` on a struct having internal data set to nullptr. Reproduction is fairly easy: 1. launch the game in Korean (I made sure to have all the indexes primed for this language beforehand - i.e. launch it twice), 2. switch to Japanese, 3. switch back to Korean Fixes #21664
This commit is contained in:
committed by
GitHub
parent
6ea091841f
commit
dfcb527ada
@@ -117,10 +117,11 @@ static void LoadSpriteFont(LocalisationService& localisationService)
|
||||
#ifndef NO_TTF
|
||||
static bool LoadFont(LocalisationService& localisationService, TTFFontSetDescriptor* font)
|
||||
{
|
||||
TTFDispose();
|
||||
localisationService.UseTrueTypeFont(true);
|
||||
|
||||
gCurrentTTFFontSet = font;
|
||||
|
||||
TTFDispose();
|
||||
bool fontInitialised = TTFInitialise();
|
||||
return fontInitialised;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user