Author: stas
Date: Tue Dec 14 07:01:46 2004
New Revision: 111819

URL: http://svn.apache.org/viewcvs?view=rev&rev=111819
Log:
fix APR::Error::str to return a lexical variable, rather than a
string. This function is called by SvTRUE in modperl_errsv() via
overload and on win32 (and randomly on linux) causes crashes via:
"Attempt to free temp prematurely" warning, where this 'temp' is the
string returned by this function. Making it a lexical variable before
returning it, resolves the problem.
Submitted by: Steve Hay

Modified:
   perl/modperl/trunk/Changes
   perl/modperl/trunk/t/perl/ithreads.t
   perl/modperl/trunk/xs/APR/Error/Error_pm

Modified: perl/modperl/trunk/Changes
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&rev=111819&p1=perl/modperl/trunk/Changes&r1=111818&p2=perl/modperl/trunk/Changes&r2=111819
==============================================================================
--- perl/modperl/trunk/Changes  (original)
+++ perl/modperl/trunk/Changes  Tue Dec 14 07:01:46 2004
@@ -12,6 +12,13 @@
 
 =item 1.99_19-dev
 
+fix APR::Error::str to return a lexical variable, rather than a
+string. This function is called by SvTRUE in modperl_errsv() via
+overload and on win32 (and randomly on linux) causes crashes via:
+"Attempt to free temp prematurely" warning, where this 'temp' is the
+string returned by this function. Making it a lexical variable before
+returning it, resolves the problem. [Steve Hay]
+
 fix META.yaml s/private/no_index/ (to hide the bundled Apache-Test
 from PAUSE indexer) [Randy Kobes]
 

Modified: perl/modperl/trunk/t/perl/ithreads.t
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/perl/ithreads.t?view=diff&rev=111819&p1=perl/modperl/trunk/t/perl/ithreads.t&r1=111818&p2=perl/modperl/trunk/t/perl/ithreads.t&r2=111819
==============================================================================
--- perl/modperl/trunk/t/perl/ithreads.t        (original)
+++ perl/modperl/trunk/t/perl/ithreads.t        Tue Dec 14 07:01:46 2004
@@ -6,15 +6,11 @@
 use Apache::Test;
 use Apache::TestRequest 'GET_BODY_ASSERT';
 
-# XXX: at the moment this test randomly fails, making it impossible to
-# debug, so skip it for now and get back to work on it later.
-
 # perl < 5.6.0 fails to compile code with 'shared' attributes, so we must skip
 # it here.
-#unless ($] >= 5.008001 && $Config{useithreads}) {
-#    plan tests => 1, need
-#        {"perl 5.8.1 or higher w/ithreads enabled is required" => 0};
-#}
-plan tests => 1, under_construction;
+unless ($] >= 5.008001 && $Config{useithreads}) {
+    plan tests => 1, need
+        {"perl 5.8.1 or higher w/ithreads enabled is required" => 0};
+}
 
 print GET_BODY_ASSERT "/TestPerl__ithreads";

Modified: perl/modperl/trunk/xs/APR/Error/Error_pm
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/APR/Error/Error_pm?view=diff&rev=111819&p1=perl/modperl/trunk/xs/APR/Error/Error_pm&r1=111818&p2=perl/modperl/trunk/xs/APR/Error/Error_pm&r2=111819
==============================================================================
--- perl/modperl/trunk/xs/APR/Error/Error_pm    (original)
+++ perl/modperl/trunk/xs/APR/Error/Error_pm    Tue Dec 14 07:01:46 2004
@@ -30,9 +30,15 @@
 # - the filename and line number are needed because perl doesn't
 #   provide that info when exception objects are involved
 sub str {
-    sprintf "%s: (%d) %s at %s line %d", $_[0]->{func},
+    # This function is called by SvTRUE in modperl_errsv() via
+    # overload and on win32 (and randomly on linux) causes crashes
+    # via: "Attempt to free temp prematurely" warning, where this
+    # 'temp' is the string returned by this function. Making it a
+    # lexical variable before returning it, resolves the problem
+    my $str = sprintf "%s: (%d) %s at %s line %d", $_[0]->{func},
         $_[0]->{rc}, APR::Error::strerror($_[0]->{rc}),
         $_[0]->{file}, $_[0]->{line};
+    return $str;
 }
 
 sub num { $_[0]->{rc} }

Reply via email to