FIX: fix memleak related to config clone

JIRA: none, found by self test

Signed-off-by: salt.wei <salt.wei@bambulab.com>
Change-Id: Ifbab17d543c60a767c0a53e1bca7dfe77bd8fbec
This commit is contained in:
salt.wei 2023-09-18 10:24:29 +08:00 committed by Lane.Wei
parent 92f2d8c37c
commit e7c380b364
2 changed files with 3 additions and 0 deletions

View File

@ -308,6 +308,7 @@ ConfigOption* ConfigOptionDef::create_default_option() const
opt->keys_map = this->enum_keys_map;
return opt;
}
delete dft;
}
return this->default_value->clone();

View File

@ -35,6 +35,7 @@ void ProjectDirtyStateManager::update_from_presets()
if (ConfigOption *color_option = wxGetApp().preset_bundle->project_config.option("filament_colour")) {
auto colors = static_cast<ConfigOptionStrings *>(color_option->clone());
m_presets_dirty |= m_initial_filament_presets_colors != colors->values;
delete colors;
}
} else {
m_presets_dirty |= !m_initial_presets[type].empty() && m_initial_presets[type] != name;
@ -66,6 +67,7 @@ void ProjectDirtyStateManager::reset_initial_presets()
if (ConfigOption *color_option = wxGetApp().preset_bundle->project_config.option("filament_colour")) {
auto colors = static_cast<ConfigOptionStrings *>(color_option->clone());
m_initial_filament_presets_colors = colors->values;
delete colors;
}
} else {
m_initial_presets[type] = name;