Father Chrysostomos via RT wrote: >Also, the patch as it is does not account for FETCH undefining the >reference. I think it will crash in that case. Yes. I think it should do the dereference (SvRV(sv)) exactly once, and hold a reference during SvGETMAGIC(). Bummer that that requires diddling refcounts, in an operation that didn't require it before. However, it can be avoided in most cases. It would suffice to create a mortal ref only in the cases where the flags say there is magic. Possibly also only in the cases where the referent is an unblessed scalar, though using those conditions would pretty much require the magic handling to be moved down into sv_reftype(). I wonder about other callers to sv_ref() and especially sv_reftype(). Many presumably have already handled magic, but maybe some ought to have it added. -zeframThread Previous | Thread Next