Commit ea17db1a authored by Kenneth Leiter's avatar Kenneth Leiter
Browse files

BUG: Fix seg faults by removing build dataitems from XdmfXmlNode to...

BUG: Fix seg faults by removing build dataitems from XdmfXmlNode to XdmfElement map so that they won't be accessed again by parent
     element.
parent 34e854a9
......@@ -97,6 +97,7 @@ XdmfAttribute::Build(){
di->SetArray(this->Values);
if(this->Values->GetNumberOfElements() > this->LightDataLimit) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
}
// PATCH September 09, Ian Curington, HR Wallingford Ltd.
......
......@@ -120,18 +120,21 @@ XdmfGeometry::Build(){
di->SetArray(this->VectorX);
if(this->VectorX->GetNumberOfElements() > this->LightDataLimit) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
// Vy
di = this->GetDataItem(1, this->GetElement());
di->SetArray(this->VectorY);
if(this->VectorY->GetNumberOfElements() > this->LightDataLimit) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
// Vx
di = this->GetDataItem(2, this->GetElement());
di->SetArray(this->VectorZ);
if(this->VectorZ->GetNumberOfElements() > this->LightDataLimit) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
break;
case XDMF_GEOMETRY_VXVY:
......@@ -144,12 +147,14 @@ XdmfGeometry::Build(){
di->SetArray(this->VectorX);
if(this->VectorX->GetNumberOfElements() > this->LightDataLimit) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
// Vy
di = this->GetDataItem(1, this->GetElement());
di->SetArray(this->VectorY);
if(this->VectorY->GetNumberOfElements() > this->LightDataLimit) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
break;
case XDMF_GEOMETRY_ORIGIN_DXDYDZ:
......@@ -161,6 +166,7 @@ XdmfGeometry::Build(){
array->SetNumberOfElements(3);
array->SetValues(0, this->Origin, 3);
di->Build();
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
// DxDyDz
di = this->GetDataItem(1, this->GetElement());
......@@ -170,6 +176,7 @@ XdmfGeometry::Build(){
array->SetNumberOfElements(3);
array->SetValues(0, this->DxDyDz, 3);
di->Build();
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
break;
case XDMF_GEOMETRY_ORIGIN_DXDY:
......@@ -181,6 +188,7 @@ XdmfGeometry::Build(){
array->SetNumberOfElements(2);
array->SetValues(0, this->Origin, 2);
di->Build();
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
// DxDy
di = this->GetDataItem(1, this->GetElement());
......@@ -190,6 +198,7 @@ XdmfGeometry::Build(){
array->SetNumberOfElements(2);
array->SetValues(0, this->DxDyDz, 2);
di->Build();
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
break;
case XDMF_GEOMETRY_NONE:
......@@ -200,6 +209,7 @@ XdmfGeometry::Build(){
di->SetArray(this->Points);
if(this->Points->GetNumberOfElements() > this->LightDataLimit) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
}else{
XdmfErrorMessage("XdmfGeometry->Points must be set for Geometry Type " << this->GetGeometryTypeAsString());
......
......@@ -116,7 +116,8 @@ XdmfSet::Build(){
di->SetArray(this->Ids);
if(this->Ids->GetNumberOfElements() > 100) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
delete di;
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
}
return(XDMF_SUCCESS);
}
......
......@@ -143,6 +143,8 @@ XdmfInt32 XdmfTime::Build(){
}
XdmfDebug("Building DataItem");
di->Build();
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
}else{
ostrstream StringOutput;
StringOutput << this->Value << ends;
......
......@@ -106,6 +106,7 @@ XdmfTopology::Build(){
di->SetArray(this->Connectivity);
if(this->Connectivity->GetNumberOfElements() > this->LightDataLimit) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
this->SetCurrentXdmfElement(di->GetElement(), NULL);
delete di;
}
return(XDMF_SUCCESS);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment