]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - Magic.xs
This is 0.30
[perl/modules/Variable-Magic.git] / Magic.xs
index aeea182bc94ce8c9db4be1a9ed98c1c15ce9c968..a922c2f5787e17342ab9195155947ba71fce27fb 100644 (file)
--- a/Magic.xs
+++ b/Magic.xs
@@ -101,6 +101,10 @@ STATIC SV *vmg_clone(pTHX_ SV *sv, tTHX owner) {
 # define mPUSHu(U) PUSHs(sv_2mortal(newSVuv(U)))
 #endif
 
+#ifndef SvPV_const
+# define SvPV_const SvPV
+#endif
+
 #ifndef PERL_MAGIC_ext
 # define PERL_MAGIC_ext '~'
 #endif
@@ -666,13 +670,13 @@ STATIC int vmg_svt_clear(pTHX_ SV *sv, MAGIC *mg) {
 }
 
 STATIC int vmg_svt_free(pTHX_ SV *sv, MAGIC *mg) {
- SV *wiz = (SV *) mg->mg_ptr;
  const MGWIZ *w;
  unsigned int flags;
  int ret = 0;
 
- /* This may happen in global destruction */
- if (SvTYPE(wiz) == SVTYPEMASK)
+ /* Don't even bother if we are in global destruction - the wizard is prisoner
+  * of circular references and we are way beyond user realm */
+ if (PL_dirty)
   return 0;
 
  w = SV2MGWIZ(mg->mg_ptr);