##
SV *sv = SvRV(obj);
if (sv) {
/* detach from the C struct and invalidate */
mg_free(sv); /* remove any magic */
SvFLAGS(sv) = 0; /* invalidate the sv */
}
####
/* Clear the sv field so that there will be no dangling ptrs */
if (it->sv) {
// SvOBJECT_off((SV *)it->sv); /* problematic, issue #385 */
mg_free(it->sv); /* remove any magic instead */
sv_setiv(it->sv,0x4242);
it->sv = NULL;
}