mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-22 18:32:16 +00:00
fix: crash when rotating the prime tower (#14499)
Selecting the prime tower and rotating it (PageUp/PageDown) crashed. Selection::notify_instance_update() indexed m_model->objects with the wipe tower's synthetic id (>= 1000), which is not a ModelObject index, so the lookup returned garbage and dereferencing it segfaulted. do_rotate/do_scale/do_mirror already skip the wipe tower in their own loops but all call this shared helper, so scale and mirror hit the same fault. Selection::drop() had the same latent bug via a direct index. Guard both with the >= 1000 check already used throughout the file. Fixes #14498
This commit is contained in:
@@ -535,6 +535,9 @@ void Selection::drop()
|
|||||||
|
|
||||||
for (unsigned int i : m_list) {
|
for (unsigned int i : m_list) {
|
||||||
GLVolume& volume = *(*m_volumes)[i];
|
GLVolume& volume = *(*m_volumes)[i];
|
||||||
|
// Skip the wipe tower: its synthetic id (>= 1000) is not an index into m_model->objects.
|
||||||
|
if (volume.object_idx() >= 1000)
|
||||||
|
continue;
|
||||||
ModelObject* model_object = m_model->objects[volume.object_idx()];
|
ModelObject* model_object = m_model->objects[volume.object_idx()];
|
||||||
|
|
||||||
if (model_object != nullptr) {
|
if (model_object != nullptr) {
|
||||||
@@ -1848,6 +1851,9 @@ void Selection::notify_instance_update(int object_idx, int instance_idx)
|
|||||||
for (unsigned int i : m_list)
|
for (unsigned int i : m_list)
|
||||||
{
|
{
|
||||||
int obj_index = (*m_volumes)[i]->object_idx();
|
int obj_index = (*m_volumes)[i]->object_idx();
|
||||||
|
// Skip the wipe tower: its synthetic id (>= 1000) is not an index into m_model->objects.
|
||||||
|
if (obj_index >= 1000)
|
||||||
|
continue;
|
||||||
//-1 means all the instance in this object
|
//-1 means all the instance in this object
|
||||||
if (instance_idx == -1)
|
if (instance_idx == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user