From 534792e249da3efb83a62279f532b6690d028592 Mon Sep 17 00:00:00 2001 From: Merill Date: Tue, 3 Sep 2024 16:14:05 +0200 Subject: [PATCH] Fix bug ShortestPath.cpp (#13331) 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 31303ddeae..a4441e6727 100644 --- a/src/libslic3r/ShortestPath.cpp +++ b/src/libslic3r/ShortestPath.cpp @@ -1957,14 +1957,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();