Fix error reporting when cgal mesh boolean crashes.

Change error report when catching SEH on cgal mesh boolean.
This commit is contained in:
tamasmeszaros 2021-06-22 18:13:35 +02:00
parent 48cd3b21b6
commit 2096a6dbbf
2 changed files with 6 additions and 3 deletions

View File

@ -208,16 +208,20 @@ static bool _cgal_intersection(CGALMesh &A, CGALMesh &B, CGALMesh &R)
template<class Op> void _cgal_do(Op &&op, CGALMesh &A, CGALMesh &B) template<class Op> void _cgal_do(Op &&op, CGALMesh &A, CGALMesh &B)
{ {
bool success = false; bool success = false;
bool hw_fail = false;
try { try {
CGALMesh result; CGALMesh result;
try_catch_signal({SIGSEGV, SIGFPE}, [&success, &A, &B, &result, &op] { try_catch_signal({SIGSEGV, SIGFPE}, [&success, &A, &B, &result, &op] {
success = op(A, B, result); success = op(A, B, result);
}, [&] { success = false; }); }, [&] { hw_fail = true; });
A = std::move(result); // In-place operation does not work A = std::move(result); // In-place operation does not work
} catch (...) { } catch (...) {
success = false; success = false;
} }
if (hw_fail)
throw Slic3r::HardCrash("CGAL mesh boolean operation crashed.");
if (! success) if (! success)
throw Slic3r::RuntimeError("CGAL mesh boolean operation failed."); throw Slic3r::RuntimeError("CGAL mesh boolean operation failed.");
} }

View File

@ -453,8 +453,7 @@ void SLAPrint::Steps::drill_holes(SLAPrintObject &po)
sla::remove_inside_triangles(mesh_view, interior, exclude_mask); sla::remove_inside_triangles(mesh_view, interior, exclude_mask);
} }
} catch (const Slic3r::RuntimeError &) {
} catch (const std::runtime_error &) {
throw Slic3r::SlicingError(L( throw Slic3r::SlicingError(L(
"Drilling holes into the mesh failed. " "Drilling holes into the mesh failed. "
"This is usually caused by broken model. Try to fix it first.")); "This is usually caused by broken model. Try to fix it first."));