Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Matena <lukasmatena@seznam.cz>2019-09-04 16:15:35 +0300
committerLukas Matena <lukasmatena@seznam.cz>2019-09-04 16:15:35 +0300
commit326eb5e3438d91f81dc03546679519c5b91b7bc5 (patch)
tree7109a488aa79bdab2a0911067f48dfc917c1d47f
parenta48ba21f40d02d5380f601d5fcd9a51671be3ba8 (diff)
GUI_ObjectList.cpp: Fixed a crash when deleting instances.version_2.1.0-rc
Deleting second-but-last instance deletes the whole Instances node, we must select object node in that case.
-rw-r--r--src/slic3r/GUI/GUI_ObjectList.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp
index 0b89939b6..20760e2bc 100644
--- a/src/slic3r/GUI/GUI_ObjectList.cpp
+++ b/src/slic3r/GUI/GUI_ObjectList.cpp
@@ -2500,15 +2500,18 @@ void ObjectList::remove()
auto delete_item = [this](wxDataViewItem item)
{
wxDataViewItem parent = m_objects_model->GetParent(item);
- if (m_objects_model->GetItemType(item) & itObject)
+ ItemType type = m_objects_model->GetItemType(item);
+ if (type & itObject)
delete_from_model_and_list(itObject, m_objects_model->GetIdByItem(item), -1);
else {
- if (m_objects_model->GetItemType(item) & itLayer) {
+ if (type & (itLayer | itInstance)) {
+ // In case there is just one layer or two instances and we delete it, del_subobject_item will
+ // also remove the parent item. Selection should therefore pass to the top parent (object).
wxDataViewItemArray children;
- if (m_objects_model->GetChildren(parent, children) == 1)
+ if (m_objects_model->GetChildren(parent, children) == (type & itLayer ? 1 : 2))
parent = m_objects_model->GetTopParent(item);
}
-
+
del_subobject_item(item);
}