From c4a422ffbb6ec5d8749099f1bca318cfd15e408b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 5 Nov 2012 11:34:53 +0000 Subject: [PATCH] Fix/workaround for carve aborts on windows The issue was caused by passing start iterator larger than end iterator to std::copy in triangulation module. It'll do nothing on linux but will throw an exception on windows. Now behavior will be identical on both platforms. Proper solution would be to figure out why exactly this happened, but it's easier to be forwarded to Tobias and we'll need to get rid of triangulation anyway. This should solve issues: #30100: boolean intersect crashes blender #33001: Crash on applying Boolean difference modifier #33045: Boolean modifier crash with mirrored objects --- extern/carve/lib/intersect_face_division.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extern/carve/lib/intersect_face_division.cpp b/extern/carve/lib/intersect_face_division.cpp index 08550c021ad..c74b52dd557 100644 --- a/extern/carve/lib/intersect_face_division.cpp +++ b/extern/carve/lib/intersect_face_division.cpp @@ -1106,7 +1106,8 @@ namespace { } // copy up to the end of the path. - std::copy(base_loop.begin() + pos, base_loop.begin() + e1_1, std::back_inserter(out)); + if (pos < e1_1) + std::copy(base_loop.begin() + pos, base_loop.begin() + e1_1, std::back_inserter(out)); CARVE_ASSERT(base_loop[e1_1] == p1.back()); std::copy(p1.rbegin(), p1.rend() - 1, std::back_inserter(out));