Skip to content

Commit

Permalink
Fix segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed Feb 13, 2022
1 parent b5cedb3 commit 41174b4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void saveFinal(const std::string &filename, int thread, float edgeSwapThreshold)

Vertex *v;
Node *n;
int i = 0;
unsigned long int i = 0;
ExtVertex **var = (ExtVertex **)malloc(sizeof(ExtVertex *)*nv);

TIN_FOREACHVERTEX(v, n) var[i++] = new ExtVertex(v);
Expand All @@ -229,6 +229,15 @@ void saveFinal(const std::string &filename, int thread, float edgeSwapThreshold)
tin.CreateIndexedTriangle(var, t.v[0], t.v[1], t.v[2]);
}

for (i=0; i<nv; i++) delete(var[i]);
free(var);

tin.removeVertices();
tin.cutAndStitch();
tin.forceNormalConsistence();
tin.duplicateNonManifoldVertices();
tin.removeDuplicatedTriangles();

tin.eulerUpdate();
tin.verticalEdgeTagging(edgeSwapThreshold);
tin.iterativeEdgeSwaps();
Expand Down

0 comments on commit 41174b4

Please sign in to comment.