From e53963204f7a61c1514c13164d2bcbaf0926822d Mon Sep 17 00:00:00 2001 From: Merill Date: Tue, 3 Sep 2024 16:14:05 +0200 Subject: [PATCH] Fix bug ShortestPath.cpp Accessing a moved object. Also this method create an unused "out" variable by removing from the parameter. I guess It should update the parameter object? Anyway, seems very wrong --- src/libslic3r/ShortestPath.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/ShortestPath.cpp b/src/libslic3r/ShortestPath.cpp index fcab5d62d9a..19e31a160a9 100644 --- a/src/libslic3r/ShortestPath.cpp +++ b/src/libslic3r/ShortestPath.cpp @@ -1951,14 +1951,15 @@ static inline void improve_ordering_by_two_exchanges_with_segment_flipping(Polyl for (const FlipEdge &edge : edges) { Polyline &pl = polylines[edge.source_index]; out.emplace_back(std::move(pl)); - if (edge.p2 == pl.first_point().cast()) { + if (edge.p2 == out.back().first_point().cast()) { // Polyline is flipped. out.back().reverse(); } else { // Polyline is not flipped. - assert(edge.p1 == pl.first_point().cast()); + assert(edge.p1 == out.back().first_point().cast()); } } + polylines = out; #ifndef NDEBUG double cost_final = cost();