From 1e37195af1d93b0b4e18871e58a6229f61bd2a0d Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 8 Nov 2016 10:23:30 -0600 Subject: [PATCH 1/2] Unit test to verify whether Slic3r would hang when croaking from a C++ exception handler. This is an unfortunate error in some Strawberry Perl distributions. Conflicts: xs/xsp/XS.xsp --- xs/MANIFEST | 1 + xs/t/22_exception.t | 16 ++++++++++++++++ xs/xsp/XS.xsp | 20 ++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 xs/t/22_exception.t diff --git a/xs/MANIFEST b/xs/MANIFEST index 4e544d472..5453a289c 100644 --- a/xs/MANIFEST +++ b/xs/MANIFEST @@ -121,6 +121,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 c54e06be5..c324396b2 100644 --- a/xs/xsp/XS.xsp +++ b/xs/xsp/XS.xsp @@ -16,4 +16,24 @@ VERSION() RETVAL = newSVpv(SLIC3R_VERSION, 0); OUTPUT: RETVAL +SV* +DEBUG_OUT_PATH_PREFIX() + CODE: + RETVAL = newSVpv(SLIC3R_DEBUG_OUT_PATH_PREFIX, 0); + OUTPUT: RETVAL + +SV* +FORK_NAME() + CODE: + 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 From b28069fe5fc246e778e6c7f58563b122aac1b874 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 13 Nov 2016 16:46:17 -0600 Subject: [PATCH 2/2] Update XS.xsp Removed references to prusa-specific SLIC3R_FORK_NAME --- xs/xsp/XS.xsp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/xs/xsp/XS.xsp b/xs/xsp/XS.xsp index c324396b2..1f6c8b610 100644 --- a/xs/xsp/XS.xsp +++ b/xs/xsp/XS.xsp @@ -16,18 +16,6 @@ VERSION() RETVAL = newSVpv(SLIC3R_VERSION, 0); OUTPUT: RETVAL -SV* -DEBUG_OUT_PATH_PREFIX() - CODE: - RETVAL = newSVpv(SLIC3R_DEBUG_OUT_PATH_PREFIX, 0); - OUTPUT: RETVAL - -SV* -FORK_NAME() - CODE: - RETVAL = newSVpv(SLIC3R_FORK_NAME, 0); - OUTPUT: RETVAL - void xspp_test_croak_hangs_on_strawberry() CODE: @@ -36,4 +24,4 @@ xspp_test_croak_hangs_on_strawberry() } catch (...) { croak("xspp_test_croak_hangs_on_strawberry: exception catched\n"); } -%} \ No newline at end of file +%}