From 70bc685101d27ca459b9015edc1fe5b49e389b29 Mon Sep 17 00:00:00 2001 From: akaitsukiakari Date: Tue, 3 Nov 2026 18:16:35 -0700 Subject: [PATCH] Fix crash when syncing filaments after a plate is deleted (#17042) The sync dialog is reused between syncs, and its plate index is left over from the last one. If that plate no longer exists, because it was deleted or a project with fewer plates was loaded, the next sync read the thumbnail of a null plate and crashed. reinit_dialog() now falls back to the current plate when the index is out of range. --- src/slic3r/GUI/SyncAmsInfoDialog.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index a39b71c751..a007513766 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -1144,6 +1144,12 @@ void SyncAmsInfoDialog::reinit_dialog() m_ams_mapping_result.clear(); m_preview_colors_in_thumbnail.clear(); + // The dialog is reused across syncs, so the plate picked last time may no longer exist + // (plates deleted or another project loaded). update_show_status() reads its thumbnail. + PartPlateList &plate_list = wxGetApp().plater()->get_partplate_list(); + if (m_specify_plate_idx < 0 || m_specify_plate_idx >= plate_list.get_plate_count()) + m_specify_plate_idx = plate_list.get_curr_plate_index(); + show_status(PrintDialogStatus::PrintStatusInit); update_show_status(); }