X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Magic.xs;h=1ac63cbf205ae3ac2ed6090033cb57530e5459c5;hb=b5acd232730bf91f384b43bc867ec1cb4d3dd147;hp=89df570ec4d896ae54599ad0408221dccbcb1a64;hpb=201d2874479e003bb82662085516a07aa04391e2;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/Magic.xs b/Magic.xs index 89df570..1ac63cb 100644 --- a/Magic.xs +++ b/Magic.xs @@ -623,6 +623,9 @@ STATIC int vmg_wizard_free(pTHX_ SV *wiz, MAGIC *mg) { MGWIZ *w; dMY_CXT; + if (PL_dirty) /* during global destruction, the context is already freed */ + return 0; + w = SV2MGWIZ(wiz); if (hv_delete(MY_CXT.wizz, buf, sprintf(buf, "%u", w->sig), 0)) { @@ -834,6 +837,7 @@ CODE: sv = MGWIZ2SV(w); mg = sv_magicext(sv, NULL, PERL_MAGIC_ext, &vmg_wizard_vtbl, NULL, -1); mg->mg_private = SIG_WIZ; + SvREADONLY_on(sv); hv_store(MY_CXT.wizz, buf, sprintf(buf, "%u", sig), sv, 0); ++MY_CXT.count;