diff --git a/xs/MANIFEST b/xs/MANIFEST index 5a0a3e420..70d83afa7 100644 --- a/xs/MANIFEST +++ b/xs/MANIFEST @@ -166,6 +166,7 @@ t/18_motionplanner.t t/19_model.t t/20_print.t t/21_gcode.t +t/22_exception.t xsp/BoundingBox.xsp xsp/BridgeDetector.xsp xsp/Clipper.xsp diff --git a/xs/t/22_exception.t b/xs/t/22_exception.t new file mode 100644 index 000000000..ca2ffea89 --- /dev/null +++ b/xs/t/22_exception.t @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Slic3r::XS; +use Test::More tests => 1; + +{ + eval { + Slic3r::xspp_test_croak_hangs_on_strawberry(); + }; + is $@, "xspp_test_croak_hangs_on_strawberry: exception catched\n", 'croak from inside a C++ exception delivered'; +} + +__END__ diff --git a/xs/xsp/XS.xsp b/xs/xsp/XS.xsp index 9b068882c..c324396b2 100644 --- a/xs/xsp/XS.xsp +++ b/xs/xsp/XS.xsp @@ -28,4 +28,12 @@ FORK_NAME() RETVAL = newSVpv(SLIC3R_FORK_NAME, 0); OUTPUT: RETVAL +void +xspp_test_croak_hangs_on_strawberry() + CODE: + try { + throw 1; + } catch (...) { + croak("xspp_test_croak_hangs_on_strawberry: exception catched\n"); + } %} \ No newline at end of file