]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - Magic.xs
Really skip free callbacks during global destruction
[perl/modules/Variable-Magic.git] / Magic.xs
index 41bf22dcd5068d655e6a3ba0d7139b64b39b9d17..a922c2f5787e17342ab9195155947ba71fce27fb 100644 (file)
--- a/Magic.xs
+++ b/Magic.xs
@@ -670,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);