From 65f57882b95e417678fdbf64e6563b7c9da36d9a Mon Sep 17 00:00:00 2001 From: "yifan.wu" Date: Wed, 19 Oct 2022 09:47:46 +0800 Subject: [PATCH] FIX: fix an exception happened in flush option in debug mode Signed-off-by: yifan.wu Change-Id: I02847ac516f560863c126ee8bf7bfc9018c2d69e --- src/libslic3r/GCode/ToolOrdering.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index bd6babb977..a99d100bf5 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -963,7 +963,15 @@ float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int // we will sort objects so that dedicated for wiping are at the beginning: ConstPrintObjectPtrs object_list = print.objects().vector(); - std::sort(object_list.begin(), object_list.end(), [](const PrintObject* a, const PrintObject* b) { return a->config().flush_into_objects; }); + // BBS: fix the exception caused by not fixed order between different objects + std::sort(object_list.begin(), object_list.end(), [object_list](const PrintObject* a, const PrintObject* b) { + if (a->config().flush_into_objects != b->config().flush_into_objects) { + return a->config().flush_into_objects.getBool(); + } + else { + return a->id() < b->id(); + } + }); // We will now iterate through // - first the dedicated objects to mark perimeters or infills (depending on infill_first)