Catching of sigsegv and sigfpe with structured exceptions on win

This commit is contained in:
tamasmeszaros 2021-06-17 15:04:47 +02:00
parent a5529aff1e
commit 976dd72b8b
8 changed files with 115 additions and 39 deletions

View file

@ -1,6 +1,7 @@
#include "Exception.hpp"
#include "MeshBoolean.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/TryCatchSignal.hpp"
#undef PI
// Include igl first. It defines "L" macro which then clashes with our localization
@ -209,7 +210,9 @@ template<class Op> void _cgal_do(Op &&op, CGALMesh &A, CGALMesh &B)
bool success = false;
try {
CGALMesh result;
success = op(A, B, result);
try_catch_signal({SIGSEGV, SIGFPE}, [&success, &A, &B, &result, &op] {
success = op(A, B, result);
}, [&] { success = false; });
A = std::move(result); // In-place operation does not work
} catch (...) {
success = false;
@ -264,6 +267,11 @@ bool does_self_intersect(const TriangleMesh &mesh)
void CGALMeshDeleter::operator()(CGALMesh *ptr) { delete ptr; }
bool does_bound_a_volume(const CGALMesh &mesh)
{
return CGALProc::does_bound_a_volume(mesh.m);
}
} // namespace cgal
} // namespace MeshBoolean