Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sever nexuses at the start of global destruction

The testsuite no longer segfaults, although it does leak memory (4 words per
interpreter created).
  • Loading branch information...
commit cca07ac031eb84be549209970e80c98103846050 1 parent 64df29f
@sorear sorear authored
View
3  src/pmc/bkmarshal.c
@@ -309,6 +309,9 @@ XS(blizkost_callable_trampoline)
blizkost_get_bound_pmc(my_perl, &nexus, (SV *)cv, &callable);
+ if (nexus->dying)
+ exit_fatal(1, "Attempted reentry of Parrot code during global destruction");
+
PERL_UNUSED_VAR(ax);
SP -= items;
PUTBACK;
View
1  src/pmc/bkmarshal.h
@@ -23,6 +23,7 @@ typedef struct blizkost_nexus {
PerlInterpreter *my_perl;
Parrot_Interp parrot_interp;
PMC *p5i;
+ int dying;
} blizkost_nexus;
#define BLIZKOST_NEXUS blizkost_nexus *nexus
View
3  src/pmc/p5interpreter.pmc
@@ -87,6 +87,7 @@ Set up P5Interpreter PMC.
SET_ATTR_nexus(interp, SELF, nexus);
nexus->parrot_interp = interp;
nexus->p5i = SELF;
+ nexus->dying = 0;
/* We turn on auto-flush to avoid oddness in interactions between
* IO systems. */
@@ -106,6 +107,8 @@ Destructor for the P5Interpreter PMC.
struct blizkost_nexus *nexus = PARROT_P5INTERPRETER(SELF)->nexus;
dBNPERL;
+ nexus->dying = 1;
+
perl_destruct(my_perl);
perl_free(my_perl);
View
3  src/pmc/p5sv.pmc
@@ -67,7 +67,8 @@ Decrement reference count of held SV.
SV *sv = PARROT_P5SV(SELF)->sv;
dBNPERL;
- SvREFCNT_dec(sv);
+ if (!nexus->dying)
+ SvREFCNT_dec(sv);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.