if (SvTYPE(wiz) == SVTYPEMASK)
return 0;
- /* So that it can survive tmp cleanup in vmg_cb_call */
+ /* So that it survives the temp cleanup in vmg_cb_call */
SvREFCNT_inc(sv);
#if !VMG_HAS_PERL_MAINT(5, 11, 0, 32686)
SvMAGIC_set(sv, mg);
#endif
- /* Perl_mg_free will get rid of the magic and decrement mg->mg_obj and
- * mg->mg_ptr reference count */
ret = vmg_cb_call1e(SV2MGWIZ(wiz)->cb_free, sv, mg->mg_obj);
/* Calling SvREFCNT_dec() will trigger destructors in an infinite loop, so
* we have to rely on SvREFCNT() being a lvalue. Heck, even the core does it */
--SvREFCNT(sv);
+ /* Perl_mg_free will get rid of the magic and decrement mg->mg_obj and
+ * mg->mg_ptr reference count */
return ret;
}
continue;
case 2:
if (!newkey)
- newkey = key = umg->mg_obj = sv_2mortal(newSVsv(umg->mg_obj));
+ newkey = key = umg->mg_obj = sv_mortalcopy(umg->mg_obj);
}
switch (action) {
case 0:
newCONSTSUB(stash, "VMG_THREADSAFE", newSVuv(VMG_THREADSAFE));
}
+#if VMG_THREADSAFE
+
void
CLONE(...)
PROTOTYPE: DISABLE
PREINIT:
HV *hv;
CODE:
-#if VMG_THREADSAFE
{
HE *key;
dMY_CXT;
MY_CXT_CLONE;
MY_CXT = hv;
}
+
#endif /* VMG_THREADSAFE */
SV *_wizard(...)