From 3bb4aaec5a6a1538a73f62933e854bd7645a1957 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 9 Oct 2023 11:01:18 +0200 Subject: [PATCH] PresetBundle: Added update of aliases maps after configuration loading, and not only after loading system presets. Note: Misses update was related to SPE-1947 : Crash when change Print settings_IS XL config bundle --- src/libslic3r/PresetBundle.cpp | 10 ++++++++++ src/libslic3r/PresetBundle.hpp | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index ac6f85e186..2f425248a1 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -408,6 +408,11 @@ void PresetBundle::update_system_maps() this->sla_materials.update_map_system_profile_renamed(); this->printers .update_map_system_profile_renamed(); + update_alias_maps(); +} + +void PresetBundle::update_alias_maps() +{ this->prints .update_map_alias_to_profile_name(); this->sla_prints .update_map_alias_to_profile_name(); this->filaments .update_map_alias_to_profile_name(); @@ -1116,6 +1121,8 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool else this->physical_printers.unselect_printer(); } + + update_alias_maps(); } // Load the active configuration of a config bundle from a boost property_tree. This is a private method called from load_config_file. @@ -1194,6 +1201,7 @@ ConfigSubstitutions PresetBundle::load_config_file_config_bundle( this->extruders_filaments[i].select_filament(load_one(this->filaments, tmp_bundle.filaments, tmp_bundle.extruders_filaments[i].get_selected_preset_name(), false)); this->update_compatible(PresetSelectCompatibleType::Never); + update_alias_maps(); sort_remove_duplicates(config_substitutions); return config_substitutions; @@ -1683,6 +1691,8 @@ std::pair PresetBundle::load_configbundle( this->update_compatible(PresetSelectCompatibleType::Never); } + update_alias_maps(); + return std::make_pair(std::move(substitutions), presets_loaded + ph_printers_loaded); } diff --git a/src/libslic3r/PresetBundle.hpp b/src/libslic3r/PresetBundle.hpp index 52042b5292..9c39ad36d2 100644 --- a/src/libslic3r/PresetBundle.hpp +++ b/src/libslic3r/PresetBundle.hpp @@ -179,6 +179,8 @@ private: std::vector merge_presets(PresetBundle &&other); // Update renamed_from and alias maps of system profiles. void update_system_maps(); + // Update alias maps + void update_alias_maps(); // Set the is_visible flag for filaments and sla materials, // apply defaults based on enabled printers when no filaments/materials are installed.