mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-07 07:17:43 -07:00
Fix cut memory leak (#11476)
This commit is contained in:
parent
c126aae902
commit
7f36a02f37
1 changed files with 5 additions and 6 deletions
|
|
@ -2168,7 +2168,7 @@ static void triangulate_slice(
|
|||
float z,
|
||||
bool triangulate,
|
||||
bool normals_down,
|
||||
const std::map<int, Vec3f*> §ion_vertices_map)
|
||||
const std::map<int, Vec3f> §ion_vertices_map)
|
||||
{
|
||||
sort_remove_duplicates(slice_vertices);
|
||||
|
||||
|
|
@ -2240,7 +2240,7 @@ static void triangulate_slice(
|
|||
int idx = -1;
|
||||
bool exist = false;
|
||||
for (auto iter = section_vertices_map.begin(); iter != section_vertices_map.end(); iter++) {
|
||||
if (is_equal(v, *iter->second)) {
|
||||
if (is_equal(v, iter->second)) {
|
||||
idx = iter->first;
|
||||
exist = true;
|
||||
break;
|
||||
|
|
@ -2348,7 +2348,7 @@ void cut_mesh(const indexed_triangle_set& mesh, float z, indexed_triangle_set* u
|
|||
IntersectionLines upper_lines, lower_lines;
|
||||
std::vector<int> upper_slice_vertices, lower_slice_vertices;
|
||||
std::vector<Vec3i32> facets_edge_ids = its_face_edge_ids(mesh);
|
||||
std::map<int, Vec3f *> section_vertices_map;
|
||||
std::map<int, Vec3f> section_vertices_map;
|
||||
|
||||
for (int facet_idx = 0; facet_idx < int(mesh.indices.size()); ++ facet_idx) {
|
||||
const stl_triangle_vertex_indices &facet = mesh.indices[facet_idx];
|
||||
|
|
@ -2357,8 +2357,8 @@ void cut_mesh(const indexed_triangle_set& mesh, float z, indexed_triangle_set* u
|
|||
float max_z = std::max(vertices[0].z(), std::max(vertices[1].z(), vertices[2].z()));
|
||||
|
||||
for (size_t i = 0; i < 3; i++) {
|
||||
if (is_equal(z, vertices[i].z()) && section_vertices_map[facet(i)] == nullptr) {
|
||||
section_vertices_map[facet(i)] = new Vec3f(vertices[i].x(), vertices[i].y(), vertices[i].z());
|
||||
if (is_equal(z, vertices[i].z()) && section_vertices_map.find(facet(i)) == section_vertices_map.end()) {
|
||||
section_vertices_map.emplace(facet(i), vertices[i]);
|
||||
}
|
||||
}
|
||||
// intersect facet with cutting plane
|
||||
|
|
@ -2554,7 +2554,6 @@ void cut_mesh(const indexed_triangle_set& mesh, float z, indexed_triangle_set* u
|
|||
}
|
||||
#endif // NDEBUG
|
||||
}
|
||||
std::map<int, Vec3f*>().swap(section_vertices_map);
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue