Fix hangs when trying to edit printer on Linux (#11714) (#11854)

On linux, some users report that attempting to edit the printer caused
OrcaSlicer to hang.
Fixes #11714
This commit is contained in:
SoftFever 2026-02-03 23:10:02 +08:00 committed by GitHub
commit 9b4af7ca1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1714,10 +1714,15 @@ Sidebar::Sidebar(Plater *parent)
p->editing_filament = -1;
if (p->combo_printer->switch_to_tab())
p->editing_filament = 0;
// ORCA clicking edit button not triggers wxEVT_KILL_FOCUS wxEVT_LEAVE_WINDOW make changes manually to prevent stucked colors when opening printer settings
p->panel_printer_preset->SetBorderColor(panel_color.bd_normal);
p->btn_edit_printer->Hide();
p->panel_printer_preset->Layout();
// ORCA: FIX crash on wxGTK, directly modifying UI (self->Hide() / parent->Layout()) inside a button event can crash because callbacks are not re-entrant, leaving widgets in an inconsistent state
wxGetApp().CallAfter([this, panel_color]() {
// ORCA clicking edit button not triggers wxEVT_KILL_FOCUS wxEVT_LEAVE_WINDOW make changes manually to prevent stucked colors when opening printer settings
if (!p || !p->panel_printer_preset || !p->btn_edit_printer)
return;
p->panel_printer_preset->SetBorderColor(panel_color.bd_normal);
p->btn_edit_printer->Hide();
p->panel_printer_preset->Layout();
});
});
ScalableBitmap bitmap_printer(p->panel_printer_preset, "printer_placeholder", PRINTER_THUMBNAIL_SIZE.GetHeight());