Fixed a crash on deleting objects due to the ObjectList accessing
released data before the selection was updated on the GLScene.
This commit is contained in:
parent
8140d043c8
commit
d54e14a41d
2 changed files with 8 additions and 9 deletions
|
@ -1521,7 +1521,8 @@ stl_stats ModelObject::get_object_stl_stats() const
|
||||||
if (this->volumes.size() == 1)
|
if (this->volumes.size() == 1)
|
||||||
return this->volumes[0]->mesh.stl.stats;
|
return this->volumes[0]->mesh.stl.stats;
|
||||||
|
|
||||||
stl_stats full_stats = this->volumes[0]->mesh.stl.stats;
|
stl_stats full_stats;
|
||||||
|
memset(&full_stats, 0, sizeof(stl_stats));
|
||||||
|
|
||||||
// fill full_stats from all objet's meshes
|
// fill full_stats from all objet's meshes
|
||||||
for (ModelVolume* volume : this->volumes)
|
for (ModelVolume* volume : this->volumes)
|
||||||
|
|
|
@ -2057,10 +2057,9 @@ void Plater::priv::remove(size_t obj_idx)
|
||||||
view3D->enable_layers_editing(false);
|
view3D->enable_layers_editing(false);
|
||||||
|
|
||||||
model.delete_object(obj_idx);
|
model.delete_object(obj_idx);
|
||||||
// Delete object from Sidebar list
|
|
||||||
sidebar->obj_list()->delete_object_from_list(obj_idx);
|
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
// Delete object from Sidebar list. Do it after update, so that the GLScene selection is updated with the modified model.
|
||||||
|
sidebar->obj_list()->delete_object_from_list(obj_idx);
|
||||||
object_list_changed();
|
object_list_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2085,10 +2084,9 @@ void Plater::priv::reset()
|
||||||
// Stop and reset the Print content.
|
// Stop and reset the Print content.
|
||||||
this->background_process.reset();
|
this->background_process.reset();
|
||||||
model.clear_objects();
|
model.clear_objects();
|
||||||
|
|
||||||
// Delete all objects from list on c++ side
|
|
||||||
sidebar->obj_list()->delete_all_objects_from_list();
|
|
||||||
update();
|
update();
|
||||||
|
// Delete object from Sidebar list. Do it after update, so that the GLScene selection is updated with the modified model.
|
||||||
|
sidebar->obj_list()->delete_all_objects_from_list();
|
||||||
object_list_changed();
|
object_list_changed();
|
||||||
|
|
||||||
// The hiding of the slicing results, if shown, is not taken care by the background process, so we do it here
|
// The hiding of the slicing results, if shown, is not taken care by the background process, so we do it here
|
||||||
|
@ -3392,14 +3390,14 @@ void Plater::decrease_instances(size_t num)
|
||||||
if (model_object->instances.size() > num) {
|
if (model_object->instances.size() > num) {
|
||||||
for (size_t i = 0; i < num; ++ i)
|
for (size_t i = 0; i < num; ++ i)
|
||||||
model_object->delete_last_instance();
|
model_object->delete_last_instance();
|
||||||
|
p->update();
|
||||||
|
// Delete object from Sidebar list. Do it after update, so that the GLScene selection is updated with the modified model.
|
||||||
sidebar().obj_list()->decrease_object_instances(obj_idx, num);
|
sidebar().obj_list()->decrease_object_instances(obj_idx, num);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
remove(obj_idx);
|
remove(obj_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
p->update();
|
|
||||||
|
|
||||||
if (!model_object->instances.empty())
|
if (!model_object->instances.empty())
|
||||||
p->get_selection().add_instance(obj_idx, (int)model_object->instances.size() - 1);
|
p->get_selection().add_instance(obj_idx, (int)model_object->instances.size() - 1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue