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

fix faulty logic

parent ed8323b9
No related branches found
No related tags found
No related merge requests found
...@@ -33,22 +33,19 @@ void PView::_init(int tag) ...@@ -33,22 +33,19 @@ void PView::_init(int tag)
va_points = va_lines = va_triangles = va_vectors = va_ellipses = 0; va_points = va_lines = va_triangles = va_vectors = va_ellipses = 0;
normals = 0; normals = 0;
bool replaced = false;
for(unsigned int i = 0; i < list.size(); i++){ for(unsigned int i = 0; i < list.size(); i++){
if(list[i]->getTag() == _tag){ if(list[i]->getTag() == _tag){
// warning: this can potentially break aliases // in normal operation this should not happen, but we allow it when
Msg::Info("Replacing View[%d] (tag = %d)", i, _tag); // programmatically forcing view tags (e.g. when using the views from
replaced = true; // within getdp's post-processing operations); this is dangerous, as it
delete list[i]; // breaks aliases
_index = i; Msg::Info("Removing existing View[%d] (tag = %d)", i, _tag);
list[i] = this; delete list[i]; // warning: this changes the list
break;
} }
} }
if(!replaced){
_index = list.size();
list.push_back(this); list.push_back(this);
} for(unsigned int i = 0; i < list.size(); i++) list[i]->setIndex(i);
} }
PView::PView(int tag) PView::PView(int tag)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment