From: Arthur Bergman Date: Sun, 12 Aug 2001 00:34:28 +0000 (+0200) Subject: SV: END {} blocks run in perl_run X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=26f423df377276528161ee2c2bb3d257fc527c90;p=p5sagit%2Fp5-mst-13.2.git SV: END {} blocks run in perl_run Message-ID: <03fd01c122b5$c803c600$052aa8c0@foo> p4raw-id: //depot/perl@11647 --- diff --git a/miniperlmain.c b/miniperlmain.c index 2c924eb..ee09fbe 100644 --- a/miniperlmain.c +++ b/miniperlmain.c @@ -74,9 +74,12 @@ main(int argc, char **argv, char **env) exitstatus = perl_parse(my_perl, xs_init, argc, argv, (char **)NULL); if (!exitstatus) { exitstatus = perl_run(my_perl); + perl_destruct(my_perl); + exitstatus = STATUS_NATIVE_EXPORT; + } else { + perl_destruct(my_perl); } - perl_destruct(my_perl); perl_free(my_perl); PERL_SYS_TERM(); diff --git a/perl.c b/perl.c index 17fbac4..7a59772 100644 --- a/perl.c +++ b/perl.c @@ -398,9 +398,16 @@ perl_destruct(pTHXx) #endif LEAVE; + { + dJMPENV; + int x = 0; + JMPENV_PUSH(x); + if (PL_endav && !PL_minus_c) + call_list(PL_scopestack_ix, PL_endav); + JMPENV_POP; + } FREETMPS; - /* We must account for everything. */ /* Destroy the main CV and syntax tree */ @@ -1499,8 +1506,6 @@ perl_run(pTHXx) LEAVE; FREETMPS; PL_curstash = PL_defstash; - if (PL_endav && !PL_minus_c) - call_list(oldscope, PL_endav); #ifdef MYMALLOC if (PerlEnv_getenv("PERL_DEBUG_MSTATS")) dump_mstats("after execution: ");