diff options
author | Jan Dubois <jand@activestate.com> | 2009-12-07 17:19:18 -0800 |
---|---|---|
committer | Jan Dubois <jand@activestate.com> | 2009-12-07 17:19:18 -0800 |
commit | 1cb985b013ea71b82afbc114ed06f94d451f5e04 (patch) | |
tree | f08febf31e05b309a373bb1d2279384238412976 /win32 | |
parent | 1144115d25e28286dc02b44859da121ea1b93f1c (diff) | |
download | perl-1cb985b013ea71b82afbc114ed06f94d451f5e04.tar.gz |
Throw away uncleanable scopes when exiting a pseudo-forked process.
Commit adab9969 tried to clean up those additional scopes, but failed
because some of the memory was allocated from a different pool. To
avoid triggering the assert() in perl_destruct() this change instead
moves the one remaining scope back to the root of the stack, effectively
discarding the additional frames without any further processing.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/perlhost.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/win32/perlhost.h b/win32/perlhost.h index 5e89f854f8..7464c7a99f 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -1771,9 +1771,14 @@ restart: CALLRUNOPS(aTHX); /* We may have additional unclosed scopes if fork() was called * from within a BEGIN block. See perlfork.pod for more details. + * We cannot clean up these other scopes because they belong to a + * different interpreter, but we also cannot leave PL_scopestack_ix + * dangling because that can trigger an assertion in perl_destruct(). */ - while (PL_scopestack_ix > oldscope) - LEAVE; + if (PL_scopestack_ix > oldscope) { + PL_scopestack[oldscope-1] = PL_scopestack[PL_scopestack_ix-1]; + PL_scopestack_ix = oldscope; + } status = 0; break; case 2: |