FIX: create custom printer crash

Jira: XXXX

Change-Id: I1ff6598d1518e6a96f55677c04ae8bfbabb2f9dd
This commit is contained in:
maosheng.wei 2024-10-18 15:09:40 +08:00 committed by Lane.Wei
parent 2263f3d627
commit dc019db185
1 changed files with 8 additions and 4 deletions

View File

@ -2292,10 +2292,12 @@ void PresetCollection::save_current_preset(const std::string &new_name, bool det
preset.config.option<ConfigOptionStrings>("filament_settings_id", true)->values[0] = new_name;
else if (m_type == Preset::TYPE_PRINTER) {
preset.config.option<ConfigOptionString>("printer_settings_id", true)->value = new_name;
if (extra_map) {
for (auto iter : *extra_map) {
preset.config.option<ConfigOptionString>(iter.first, true)->value = iter.second;
}
}
}
final_inherits = preset.inherits();
unlock();
// TODO: apply change from custom root to devided presets.
@ -2341,10 +2343,12 @@ void PresetCollection::save_current_preset(const std::string &new_name, bool det
preset.config.option<ConfigOptionStrings>("filament_settings_id", true)->values[0] = new_name;
else if (m_type == Preset::TYPE_PRINTER) {
preset.config.option<ConfigOptionString>("printer_settings_id", true)->value = new_name;
if (extra_map) {
for (auto iter : *extra_map) {
preset.config.option<ConfigOptionString>(iter.first, true)->value = iter.second;
}
}
}
//BBS: add lock logic for sync preset in background
final_inherits = inherits;
unlock();