Skip to content

Commit 18d91f1

Browse files
Fix crash opening Batch Preset Management
on_nozzle_filter_changed was called during button creation which triggered apply_filters/layout_preset_list before m_preset_sizers were populated. Set initial button visuals directly without calling the filter handler.
1 parent 5e50829 commit 18d91f1

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/slic3r/GUI/UserPresetsDialog.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,18 @@ void UserPresetsDialog::create_nozzle_filter_buttons(wxWindow *parent)
211211
m_nozzle_buttons.push_back(btn);
212212
}
213213

214-
// Set initial visual state (All selected)
215-
on_nozzle_filter_changed("");
214+
// Set initial visual state (All selected) — don't apply filters yet, presets aren't created
215+
m_nozzle_filter = "";
216+
for (size_t i = 0; i < m_nozzle_buttons.size(); i++) {
217+
if (i == 0) {
218+
m_nozzle_buttons[i]->SetBackgroundColor(wxColour("#00AE42"));
219+
m_nozzle_buttons[i]->SetTextColorNormal(*wxWHITE);
220+
} else {
221+
bool dark = wxGetApp().dark_mode();
222+
m_nozzle_buttons[i]->SetBackgroundColor(dark ? wxColour(78, 78, 78) : wxColour("#F0F0F0"));
223+
m_nozzle_buttons[i]->SetTextColorNormal(dark ? wxColour(250, 250, 250) : wxColour("#262E30"));
224+
}
225+
}
216226
}
217227

218228
void UserPresetsDialog::on_nozzle_filter_changed(const std::string &nozzle)

0 commit comments

Comments
 (0)