mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 06:57:36 -06:00
Fix crash when resetting filament presets (#8911)
* Fix crash when resetting filament presets (SoftFever/OrcaSlicer#8863) * Fix crash when resetting filament presets when dependencies are changed (SoftFever/OrcaSlicer#8849) * Merge branch 'main' into bugfox/mm-preset-reset-crash
This commit is contained in:
parent
c73513ee0d
commit
61464de50b
1 changed files with 13 additions and 7 deletions
|
@ -1069,17 +1069,21 @@ void Tab::on_roll_back_value(const bool to_sys /*= true*/)
|
|||
to_sys ? group->back_to_sys_value("compatible_printers") : group->back_to_initial_value("compatible_printers");
|
||||
load_key_value("compatible_printers", true/*some value*/, true);
|
||||
|
||||
bool is_empty = m_config->option<ConfigOptionStrings>("compatible_printers")->values.empty();
|
||||
m_compatible_printers.checkbox->SetValue(is_empty);
|
||||
is_empty ? m_compatible_printers.btn->Disable() : m_compatible_printers.btn->Enable();
|
||||
if (m_compatible_printers.checkbox) {
|
||||
bool is_empty = m_config->option<ConfigOptionStrings>("compatible_printers")->values.empty();
|
||||
m_compatible_printers.checkbox->SetValue(is_empty);
|
||||
is_empty ? m_compatible_printers.btn->Disable() : m_compatible_printers.btn->Enable();
|
||||
}
|
||||
}
|
||||
if ((m_type == Preset::TYPE_FILAMENT || m_type == Preset::TYPE_SLA_MATERIAL) && (m_options_list["compatible_prints"] & os) == 0) {
|
||||
to_sys ? group->back_to_sys_value("compatible_prints") : group->back_to_initial_value("compatible_prints");
|
||||
load_key_value("compatible_prints", true/*some value*/, true);
|
||||
|
||||
bool is_empty = m_config->option<ConfigOptionStrings>("compatible_prints")->values.empty();
|
||||
m_compatible_prints.checkbox->SetValue(is_empty);
|
||||
is_empty ? m_compatible_prints.btn->Disable() : m_compatible_prints.btn->Enable();
|
||||
if (m_compatible_prints.checkbox) {
|
||||
bool is_empty = m_config->option<ConfigOptionStrings>("compatible_prints")->values.empty();
|
||||
m_compatible_prints.checkbox->SetValue(is_empty);
|
||||
is_empty ? m_compatible_prints.btn->Disable() : m_compatible_prints.btn->Enable();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const auto &kvp : group->opt_map()) {
|
||||
|
@ -4186,7 +4190,9 @@ if (is_marlin_flavor)
|
|||
// optgroup->get_value() return int for def.type == coInt,
|
||||
// Thus, there should be boost::any_cast<int> !
|
||||
// Otherwise, boost::any_cast<size_t> causes an "unhandled unknown exception"
|
||||
size_t extruders_count = size_t(boost::any_cast<int>(optgroup_sh->get_value("extruders_count")));
|
||||
const auto v = optgroup_sh->get_value("extruders_count");
|
||||
if (v.empty()) return;
|
||||
size_t extruders_count = size_t(boost::any_cast<int>(v));
|
||||
wxTheApp->CallAfter([this, opt_key, value, extruders_count]() {
|
||||
if (opt_key == "extruders_count" || opt_key == "single_extruder_multi_material") {
|
||||
extruders_count_changed(extruders_count);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue