1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-02-02 19:56:13 +01:00

Release config on closing to limit leaked memory

This commit is contained in:
Michał Janiszewski
2016-01-13 17:42:34 +01:00
parent 57420cbc66
commit ab3d2a1ad9
4 changed files with 26 additions and 3 deletions

View File

@@ -171,18 +171,24 @@ void colour_scheme_update_by_class(rct_window *window, rct_windowclass classific
window->flags |= WF_TRANSPARENT;
}
static void theme_set_preset_string(const utf8string preset)
{
SafeFree(gConfigInterface.current_theme_preset);
gConfigInterface.current_theme_preset = strdup(preset);
}
void theme_change_preset(int preset)
{
if (preset >= 0 && preset < gConfigThemes.num_presets) {
switch (preset) {
case 0:
gConfigInterface.current_theme_preset = "*RCT2";
theme_set_preset_string("*RCT2");
break;
case 1:
gConfigInterface.current_theme_preset = "*RCT1";
theme_set_preset_string("*RCT1");
break;
default:
gConfigInterface.current_theme_preset = gConfigThemes.presets[preset].name;
theme_set_preset_string(gConfigThemes.presets[preset].name);
break;
}
gCurrentTheme = preset;