Change 29451 by [EMAIL PROTECTED] on 2006/12/04 14:31:08
Change #29424 may well be correct in itself, but currently doesn't
work when perl is built with PERL_IMPLICIT_SYS because PERLIO_TERM
uses PerlMemShared_free() which, in that case, involves the perlhost
that has already been freed itself by perl_free(), which is called
before PERL_SYS_TERM().
The order of perl_destruct(), perl_free(), PERL_SYS_TERM() cannot
be changed (it is advertised in perlembed for a start), so just
revert #29424 and the appropriate parts of #29442 for now.
Perhaps PL_perlio_fd_refcnt needs allocating differently, or else
the perlhost needs freeing later (after PerlIO)?
Affected files ...
... //depot/perl/win32/perllib.c#59 edit
... //depot/perl/win32/win32.c#266 edit
... //depot/perl/win32/wince.c#3 edit
Differences ...
==== //depot/perl/win32/perllib.c#59 (text) ====
Index: perl/win32/perllib.c
--- perl/win32/perllib.c#58~29442~ 2006-12-03 11:16:17.000000000 -0800
+++ perl/win32/perllib.c 2006-12-04 06:31:08.000000000 -0800
@@ -248,28 +248,18 @@
exitstatus = perl_run(my_perl);
#endif
}
-
+
perl_destruct(my_perl);
-#ifdef USE_ITHREADS
- if (new_perl) {
- PERL_SET_THX(new_perl);
- perl_destruct(new_perl);
- PERL_SET_THX(my_perl);
- }
-#endif
-
- PERL_SYS_TERM();
-
perl_free(my_perl);
-
#ifdef USE_ITHREADS
if (new_perl) {
PERL_SET_THX(new_perl);
+ perl_destruct(new_perl);
perl_free(new_perl);
}
#endif
-
+ PERL_SYS_TERM();
return (exitstatus);
}
==== //depot/perl/win32/win32.c#266 (text) ====
Index: perl/win32/win32.c
--- perl/win32/win32.c#265~29424~ 2006-11-30 01:45:47.000000000 -0800
+++ perl/win32/win32.c 2006-12-04 06:31:08.000000000 -0800
@@ -4902,10 +4902,11 @@
void
Perl_win32_term(void)
{
- dTHX;
HINTS_REFCNT_TERM;
OP_REFCNT_TERM;
- PERLIO_TERM;
+ /* Can't call PERLIO_TERM here because that calls PerlMemShared_free()
+ * but we're too late for that (at least when using PERL_IMPLICIT_SYS)
+ * since we've already done perl_free(). */
MALLOC_TERM;
}
==== //depot/perl/win32/wince.c#3 (text) ====
Index: perl/win32/wince.c
--- perl/win32/wince.c#2~29424~ 2006-11-30 01:45:47.000000000 -0800
+++ perl/win32/wince.c 2006-12-04 06:31:08.000000000 -0800
@@ -2660,10 +2660,11 @@
DllExport void
Perl_win32_term(void)
{
- dTHX;
HINTS_REFCNT_TERM;
OP_REFCNT_TERM;
- PERLIO_TERM;
+ /* Can't call PERLIO_TERM here because that calls PerlMemShared_free()
+ * but we're too late for that (at least when using PERL_IMPLICIT_SYS)
+ * since we've already done perl_free(). */
MALLOC_TERM;
}
End of Patch.