From 2096a6dbbff83a22eb5c386bad7f85f7c10a93fb Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 22 Jun 2021 18:13:35 +0200 Subject: [PATCH] Fix error reporting when cgal mesh boolean crashes. Change error report when catching SEH on cgal mesh boolean. --- src/libslic3r/MeshBoolean.cpp | 6 +++++- src/libslic3r/SLAPrintSteps.cpp | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/MeshBoolean.cpp b/src/libslic3r/MeshBoolean.cpp index f58ae0bfe..599ac4784 100644 --- a/src/libslic3r/MeshBoolean.cpp +++ b/src/libslic3r/MeshBoolean.cpp @@ -208,16 +208,20 @@ static bool _cgal_intersection(CGALMesh &A, CGALMesh &B, CGALMesh &R) template void _cgal_do(Op &&op, CGALMesh &A, CGALMesh &B) { bool success = false; + bool hw_fail = false; try { CGALMesh result; try_catch_signal({SIGSEGV, SIGFPE}, [&success, &A, &B, &result, &op] { success = op(A, B, result); - }, [&] { success = false; }); + }, [&] { hw_fail = true; }); A = std::move(result); // In-place operation does not work } catch (...) { success = false; } + if (hw_fail) + throw Slic3r::HardCrash("CGAL mesh boolean operation crashed."); + if (! success) throw Slic3r::RuntimeError("CGAL mesh boolean operation failed."); } diff --git a/src/libslic3r/SLAPrintSteps.cpp b/src/libslic3r/SLAPrintSteps.cpp index b267116e9..4a8d0d4be 100644 --- a/src/libslic3r/SLAPrintSteps.cpp +++ b/src/libslic3r/SLAPrintSteps.cpp @@ -453,8 +453,7 @@ void SLAPrint::Steps::drill_holes(SLAPrintObject &po) sla::remove_inside_triangles(mesh_view, interior, exclude_mask); } - - } catch (const std::runtime_error &) { + } catch (const Slic3r::RuntimeError &) { throw Slic3r::SlicingError(L( "Drilling holes into the mesh failed. " "This is usually caused by broken model. Try to fix it first."));