diff --git a/xs/src/admesh/shared.c b/xs/src/admesh/shared.c index 62a1d95c..59fbbb21 100644 --- a/xs/src/admesh/shared.c +++ b/xs/src/admesh/shared.c @@ -26,10 +26,14 @@ void stl_invalidate_shared_vertices(stl_file *stl) { - if (stl->v_indices != NULL) + if (stl->v_indices != NULL) { free(stl->v_indices); - if (stl->v_shared != NULL) + stl->v_indices = NULL; + } + if (stl->v_shared != NULL) { free(stl->v_shared); + stl->v_shared = NULL; + } } void diff --git a/xs/xsp/TriangleMesh.xsp b/xs/xsp/TriangleMesh.xsp index 58fc9bb9..7f47df61 100644 --- a/xs/xsp/TriangleMesh.xsp +++ b/xs/xsp/TriangleMesh.xsp @@ -37,7 +37,7 @@ TriangleMesh::stats() SV* TriangleMesh::vertices() CODE: - if (THIS->stl.stats.shared_vertices == 0) + if (THIS->stl.v_shared == NULL) stl_generate_shared_vertices(&(THIS->stl)); // vertices @@ -59,7 +59,7 @@ TriangleMesh::vertices() SV* TriangleMesh::facets() CODE: - if (THIS->stl.stats.shared_vertices == 0) + if (THIS->stl.v_shared == NULL) stl_generate_shared_vertices(&(THIS->stl)); // facets