X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FVariable-Magic.git;a=blobdiff_plain;f=Magic.xs;h=b810d91f9db40a63c90e9a75711a8861a809967f;hp=9eda482e03a65e3652c7732e63b921a0386b47da;hb=2ccccc5e7ea3f299777e0b67db864a1ea60688a6;hpb=2e52ce0819fd8c02f7b5c13dbea35d4e44568cde diff --git a/Magic.xs b/Magic.xs index 9eda482..b810d91 100644 --- a/Magic.xs +++ b/Magic.xs @@ -1246,11 +1246,18 @@ static int vmg_cb_call(pTHX_ SV *cb, unsigned int flags, SV *sv, ...) { svr = POPs; if (SvOK(svr)) ret = (int) SvIV(svr); + if (SvROK(svr)) + SvREFCNT_inc(svr); + else + svr = NULL; PUTBACK; FREETMPS; LEAVE; + if (svr && !SvTEMP(svr)) + sv_2mortal(svr); + if (chain) { vmg_dispell_guard_new(*chain); *chain = NULL;