From 039b8c4ed9d554197b820b93af514b543ff84fef Mon Sep 17 00:00:00 2001 From: Ian Bassi Date: Tue, 17 Nov 2026 21:47:06 -0300 Subject: [PATCH] Fix a crash in the object list after arranging Arranging rebuilds the plates in arrange order, which re-sorts the model objects. The object list then synced its selection from GLVolumes that still carried the old object indices, and with a part or modifier selected it read past the end of another object's volumes. Reload the scene before syncing the object list, and skip indices that are out of range. Ported from Snapmaker/OrcaSlicer@fd6e55e7349d65ce3e0adc92b57cb55dab04b9c0 Co-authored-by: XieJiajun <68017138+PILIPALA030@users.noreply.github.com> --- src/slic3r/GUI/GUI_ObjectList.cpp | 2 ++ src/slic3r/GUI/Jobs/ArrangeJob.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index ef7403d9f2..796e2bbf4a 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -5322,6 +5322,8 @@ void ObjectList::update_selections() int obj_idx = gl_vol->object_idx(); int vol_idx = gl_vol->volume_idx(); assert(obj_idx >= 0 && vol_idx >= 0); + if (obj_idx >= int(m_objects->size()) || vol_idx >= int(object(obj_idx)->volumes.size())) + continue; if (object(obj_idx)->volumes[vol_idx]->is_cut_connector()) sels.Add(m_objects_model->GetInfoItemByType(m_objects_model->GetItemById(obj_idx), InfoItemType::CutConnectors)); else { diff --git a/src/slic3r/GUI/Jobs/ArrangeJob.cpp b/src/slic3r/GUI/Jobs/ArrangeJob.cpp index b78ca6f859..4ab0d527dc 100644 --- a/src/slic3r/GUI/Jobs/ArrangeJob.cpp +++ b/src/slic3r/GUI/Jobs/ArrangeJob.cpp @@ -1005,6 +1005,9 @@ void ArrangeJob::finalize(bool canceled, std::exception_ptr &eptr) { // BBS: update slice context and gcode result. m_plater->update_slicing_context_to_current_partplate(); + // The plates were rebuilt in arrange order, so the GLVolume ids are stale until the scene reloads. + m_plater->get_view3D_canvas3D()->reload_scene(true); + wxGetApp().obj_list()->reload_all_plates(); m_plater->update();