X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xs-src%2FMouseUtil.xs;h=5b01e404c0d56e99c0f45b6451c0d2e1954fa2e3;hb=b3cd4c14b73eb0160d29f7d76828de0060c0b522;hp=8587b6457403fcac4f2cda16d9f1241077b66f25;hpb=25ba356eb567d89ae015ad0789960b460c3ebf02;p=gitmo%2FMouse.git diff --git a/xs-src/MouseUtil.xs b/xs-src/MouseUtil.xs index 8587b64..5b01e40 100644 --- a/xs-src/MouseUtil.xs +++ b/xs-src/MouseUtil.xs @@ -120,6 +120,28 @@ mouse_throw_error(SV* const metaobject, SV* const data /* not used */, const cha } } +/* workaround RT #69939 */ +I32 +mouse_call_sv_safe(pTHX_ SV* const sv, I32 const flags) { + assert( (flags & G_EVAL) == 0 ); + + if(!PL_in_eval) { + I32 count; + SAVESPTR(ERRSV); + ERRSV = sv_newmortal(); + + count = Perl_call_sv(aTHX_ sv, flags | G_EVAL); + + if(sv_true(ERRSV)){ + croak(NULL); /* rethrow */ + } + return count; + } + else { + return Perl_call_sv(aTHX_ sv, flags); + } +} + void mouse_must_defined(pTHX_ SV* const value, const char* const name) { assert(value); @@ -199,7 +221,7 @@ mouse_call0 (pTHX_ SV* const self, SV* const method) { XPUSHs(self); PUTBACK; - call_sv(method, G_SCALAR | G_METHOD); + call_sv_safe(method, G_SCALAR | G_METHOD); SPAGAIN; ret = POPs; @@ -219,7 +241,7 @@ mouse_call1 (pTHX_ SV* const self, SV* const method, SV* const arg1) { PUSHs(arg1); PUTBACK; - call_sv(method, G_SCALAR | G_METHOD); + call_sv_safe(method, G_SCALAR | G_METHOD); SPAGAIN; ret = POPs;