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

Fix crash due to identical vertex pointers in Mesh.Points and
Mesh.Vertices
parent d0439581
No related branches found
No related tags found
No related merge requests found
// $Id: Generator.cpp,v 1.39 2003-03-01 22:36:42 geuzaine Exp $ // $Id: Generator.cpp,v 1.40 2003-03-10 04:26:32 geuzaine Exp $
// //
// Copyright (C) 1997 - 2003 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997 - 2003 C. Geuzaine, J.-F. Remacle
// //
...@@ -185,49 +185,38 @@ void Init_Mesh(Mesh * M, int all) ...@@ -185,49 +185,38 @@ void Init_Mesh(Mesh * M, int all)
ExitExtrude(); ExitExtrude();
if(M->Vertices) {
Tree_Action(M->Vertices, Free_Vertex); Tree_Action(M->Vertices, Free_Vertex);
Tree_Delete(M->Vertices); Tree_Delete(M->Vertices);
}
if(M->VertexEdges) {
Tree_Action(M->VertexEdges, Free_Vertex); Tree_Action(M->VertexEdges, Free_Vertex);
Tree_Delete(M->VertexEdges); Tree_Delete(M->VertexEdges);
}
if(M->Simplexes) {
// Tree_Action (M->Simplexes, Free_Simplex); //produit des crashes innatendus...
// normal, cette memoire est dupliquee
// dans les volumes. Je crois qu'on a besoin
// des 2, ce truc ne provoque pas de leaks.
Tree_Delete(M->Simplexes);
}
if(M->Points) {
Tree_Action(M->Points, Free_Vertex); Tree_Action(M->Points, Free_Vertex);
Tree_Delete(M->Points); Tree_Delete(M->Points);
}
if(M->Curves) { // Note: don't free the simplices here (with
// Tree_Action (M->Simplexes, Free_Simplex)): we free them
// in each curve, surface, volume
Tree_Delete(M->Simplexes);
Tree_Action(M->Curves, Free_Curve); Tree_Action(M->Curves, Free_Curve);
Tree_Delete(M->Curves); Tree_Delete(M->Curves);
}
if(M->SurfaceLoops) { //Tree_Action (M->SurfaceLoops, Free_SurfaceLoop); // todo
//Tree_Action (M->SurfaceLoops, Free_SurfaceLoop);
Tree_Delete(M->SurfaceLoops); Tree_Delete(M->SurfaceLoops);
}
if(M->EdgeLoops) { //Tree_Action (M->EdgeLoops, Free_EdgeLoop); // todo
//Tree_Action (M->EdgeLoops, Free_EdgeLoop);
Tree_Delete(M->EdgeLoops); Tree_Delete(M->EdgeLoops);
}
if(M->Surfaces) {
Tree_Action(M->Surfaces, Free_Surface); Tree_Action(M->Surfaces, Free_Surface);
Tree_Delete(M->Surfaces); Tree_Delete(M->Surfaces);
}
if(M->Volumes) { Tree_Action(M->Volumes, Free_Volume);
Tree_Action(M->Volumes, Free_Volume); //produit des crashes innatendus...
Tree_Delete(M->Volumes); Tree_Delete(M->Volumes);
}
if(M->PhysicalGroups) { //Tree_Action (M->PhysicalGroups, Free_PhysicalGroup); // todo
//Tree_Action (M->PhysicalGroups, Free_PhysicalGroup);
List_Delete(M->PhysicalGroups); List_Delete(M->PhysicalGroups);
}
if(M->Metric) { if(M->Metric) {
delete M->Metric; delete M->Metric;
} }
......
// $Id: Read_Mesh.cpp,v 1.50 2003-03-01 22:36:42 geuzaine Exp $ // $Id: Read_Mesh.cpp,v 1.51 2003-03-10 04:26:32 geuzaine Exp $
// //
// Copyright (C) 1997 - 2003 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997 - 2003 C. Geuzaine, J.-F. Remacle
// //
...@@ -316,7 +316,11 @@ void Read_Mesh_MSH(Mesh * M, FILE * File_GEO) ...@@ -316,7 +316,11 @@ void Read_Mesh_MSH(Mesh * M, FILE * File_GEO)
M->Statistics[12]++; M->Statistics[12]++;
break; break;
case PNT: case PNT:
Tree_Replace(M->Points, &vertsp[0]); // we need to make a new one: vertices in M->Vertices and
// M->Points should never point to the same memory location
vert = Create_Vertex(vertsp[0]->Num, vertsp[0]->Pos.X, vertsp[0]->Pos.Y,
vertsp[0]->Pos.Z, vertsp[0]->lc, vertsp[0]->w);
Tree_Replace(M->Points, &vert);
break; break;
default: default:
Msg(WARNING, "Unknown type of element in Read_Mesh"); Msg(WARNING, "Unknown type of element in Read_Mesh");
......
$Id: VERSIONS,v 1.133 2003-03-07 18:35:56 geuzaine Exp $ $Id: VERSIONS,v 1.134 2003-03-10 04:26:32 geuzaine Exp $
New in 1.42: suppressed the automatic addition of a ".geo" extension New in 1.42: suppressed the automatic addition of a ".geo" extension
if the file given on the command line is not recognized; if the file given on the command line is not recognized; fixed various
small bugs;
New in 1.41: Gmsh is now licensed under the GNU General Public New in 1.41: Gmsh is now licensed under the GNU General Public
License; general code cleanup (indent); License; general code cleanup (indent);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment