Fix for #12005 - 2.7.1: One particular .3mf project crashes when changing printer from XL to MK4

Follow-up 23ffd344:
Note, that crash was caused by missing update of the active extruder.
This commit is contained in:
YuSanka 2024-01-22 13:56:26 +01:00
parent 540b800a5c
commit c7fa6b0f73
2 changed files with 8 additions and 6 deletions

View File

@ -502,7 +502,7 @@ void Tab::OnActivate()
update_btns_enabling();
m_btn_hide_incompatible_presets->Show(m_show_btn_incompatible_presets && m_type != Slic3r::Preset::TYPE_PRINTER);
if (TabFilament* tab = dynamic_cast<TabFilament*>(this))
tab->update_extruder_combobox();
tab->update_extruder_combobox_visibility();
Layout();
}
@ -2104,15 +2104,16 @@ void TabFilament::create_extruder_combobox()
m_h_buttons_sizer->Add(m_extruders_cb, 0, wxALIGN_CENTER_VERTICAL);
}
void TabFilament::update_extruder_combobox_visibility()
{
const size_t extruder_cnt = static_cast<const ConfigOptionFloats*>(m_preset_bundle->printers.get_edited_preset().config.option("nozzle_diameter"))->values.size();
m_extruders_cb->Show(extruder_cnt > 1);
}
void TabFilament::update_extruder_combobox()
{
if (!m_presets_choice->IsShown())
return; // it will be updated later, on OnActive()
const size_t extruder_cnt = static_cast<const ConfigOptionFloats*>(m_preset_bundle->printers.get_edited_preset().config.option("nozzle_diameter"))->values.size();
m_extruders_cb->Show(extruder_cnt > 1);
if (extruder_cnt != m_extruders_cb->GetCount()) {
m_extruders_cb->Clear();
for (size_t id = 1; id <= extruder_cnt; id++)

View File

@ -496,6 +496,7 @@ public:
bool set_active_extruder(int new_selected_extruder);
void invalidate_active_extruder() { m_active_extruder = -1; }
void update_extruder_combobox();
void update_extruder_combobox_visibility();
int get_active_extruder() const { return m_active_extruder; }
const std::string& get_custom_gcode(const t_config_option_key& opt_key) override;