Skip to content
Snippets Groups Projects
Commit 84a023cd authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

when deleting a model, when no other model is visible, make the last one visible

parent 6413d534
No related branches found
No related tags found
No related merge requests found
...@@ -93,13 +93,23 @@ GModel::~GModel() ...@@ -93,13 +93,23 @@ GModel::~GModel()
{ {
std::vector<GModel*>::iterator it = std::find(list.begin(), list.end(), this); std::vector<GModel*>::iterator it = std::find(list.begin(), list.end(), this);
if(it != list.end()) list.erase(it); if(it != list.end()) list.erase(it);
if(getVisibility()){
// if no other model is visible, make the last one visible
bool othervisible = false;
for(unsigned int i = 0; i < list.size(); i++){
if(list[i]->getVisibility()) othervisible = true;
}
if(!othervisible && list.size())
list.back()->setVisibility(1);
}
destroy(); destroy();
_deleteGEOInternals(); _deleteGEOInternals();
_deleteOCCInternals(); _deleteOCCInternals();
#if defined(HAVE_MESH) #if defined(HAVE_MESH)
delete _fields; delete _fields;
#endif #endif
if(_factory) if(_factory)
delete _factory; delete _factory;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment