X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xs-src%2FMouseUtil.xs;h=2d557a6c81331fa1039a68942a1cac2244eb8967;hb=d6ceb359d08b474a9f0911c7d7c3fd319761b0ae;hp=5b01e404c0d56e99c0f45b6451c0d2e1954fa2e3;hpb=b3cd4c14b73eb0160d29f7d76828de0060c0b522;p=gitmo%2FMouse.git diff --git a/xs-src/MouseUtil.xs b/xs-src/MouseUtil.xs index 5b01e40..2d557a6 100644 --- a/xs-src/MouseUtil.xs +++ b/xs-src/MouseUtil.xs @@ -120,26 +120,28 @@ mouse_throw_error(SV* const metaobject, SV* const data /* not used */, const cha } } -/* workaround RT #69939 */ +/* workaround Perl-RT #69939 */ I32 mouse_call_sv_safe(pTHX_ SV* const sv, I32 const flags) { - assert( (flags & G_EVAL) == 0 ); + I32 count; + ENTER; + /* Don't do SAVETMPS */ - if(!PL_in_eval) { - I32 count; - SAVESPTR(ERRSV); - ERRSV = sv_newmortal(); + SAVESPTR(ERRSV); + ERRSV = sv_newmortal(); - count = Perl_call_sv(aTHX_ sv, flags | G_EVAL); + 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); + if(sv_true(ERRSV)){ + SV* const err = sv_mortalcopy(ERRSV); + LEAVE; + sv_setsv(ERRSV, err); + croak(NULL); /* rethrow */ } + + LEAVE; + + return count; } void @@ -346,7 +348,7 @@ mouse_install_sub(pTHX_ GV* const gv, SV* const code_ref) { } } - CvGV(cv) = gv; + CvGV_set(cv, gv); CvANON_off(cv); } }