From: Vincent Pit Date: Mon, 3 Aug 2015 14:03:13 +0000 (-0300) Subject: Stop copying the reap-ed coderef X-Git-Tag: rt104751~1 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=f5baf3c7bce8c08d6475fdcdb20fe23798f5cd8b;p=perl%2Fmodules%2FScope-Upper.git Stop copying the reap-ed coderef --- diff --git a/Upper.xs b/Upper.xs index 18ba986..928fdfd 100644 --- a/Upper.xs +++ b/Upper.xs @@ -2872,7 +2872,9 @@ CODE: cxix = su_context_normalize_down(cxix); Newx(ud, 1, su_ud_reap); SU_UD_TYPE(ud) = SU_UD_TYPE_REAP; - ud->cb = newSVsv(hook); + ud->cb = (SvROK(hook) && SvTYPE(SvRV(hook)) >= SVt_PVCV) + ? SvRV(hook) : hook; + SvREFCNT_inc_simple_void(ud->cb); su_init(ud, cxix, SU_SAVE_DESTRUCTOR_SIZE); void