You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by to...@apache.org on 2012/02/14 21:09:13 UTC
svn commit: r1244196 - in /perl/modperl/branches/threading: ./ Changes
lib/ModPerl/MM.pm src/modules/perl/modperl_const.c
src/modules/perl/modperl_perl.c
Author: torsten
Date: Tue Feb 14 20:09:12 2012
New Revision: 1244196
URL: http://svn.apache.org/viewvc?rev=1244196&view=rev
Log:
Merged revisions 1243923,1244184 via svnmerge from
https://svn.eu.apache.org/repos/asf/perl/modperl/trunk
........
r1243923 | stevehay | 2012-02-14 15:04:05 +0100 (Tue, 14 Feb 2012) | 2 lines
Correct the initialization of the build config in ModPerl::MM, simply borrowing the style of ModPerl::BuildMM to do so.
........
r1244184 | torsten | 2012-02-14 20:29:11 +0100 (Tue, 14 Feb 2012) | 12 lines
Fix 2 SV REFCNT bugs:
- modperl_perl_core_global_init(), the aliasing GV references the aliased
CV. Thus, it should increment the REFCNT.
- new_constsub() in modperl_const.c, same story.
The bug has been there for years. Only starting with perl 5.14 it became
visible by messages like this in the error_log:
Attempt to free unreferenced scalar: SV 0x7fc218,
Perl interpreter: 0x7cfdb0 during global destruction.
........
Modified:
perl/modperl/branches/threading/ (props changed)
perl/modperl/branches/threading/Changes
perl/modperl/branches/threading/lib/ModPerl/MM.pm
perl/modperl/branches/threading/src/modules/perl/modperl_const.c
perl/modperl/branches/threading/src/modules/perl/modperl_perl.c
Propchange: perl/modperl/branches/threading/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 14 20:09:12 2012
@@ -1 +1 @@
-/perl/modperl/trunk:594682-672484,672819-681118,693357,700369,732889-736218,751909-752425,757553-774171,807116,807332-807649,907778-932879,933373-933563,935519,936643,940287,957309-983073,985740,987933-1023553,1029211-1052232,1062311-1062448,1066644-1074122,1076733,1083541,1089349-1096565,1124132,1125476-1145161,1213838-1222775,1241435
+/perl/modperl/trunk:594682-672484,672819-681118,693357,700369,732889-736218,751909-752425,757553-774171,807116,807332-807649,907778-932879,933373-933563,935519,936643,940287,957309-983073,985740,987933-1023553,1029211-1052232,1062311-1062448,1066644-1074122,1076733,1083541,1089349-1096565,1124132,1125476-1145161,1213838-1222775,1241435,1243923-1244184
Propchange: perl/modperl/branches/threading/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Feb 14 20:09:12 2012
@@ -1 +1 @@
-/perl/modperl/trunk:1-712967,712969-1241559
+/perl/modperl/trunk:1-712967,712969-1241872,1241874-1244192
Modified: perl/modperl/branches/threading/Changes
URL: http://svn.apache.org/viewvc/perl/modperl/branches/threading/Changes?rev=1244196&r1=1244195&r2=1244196&view=diff
==============================================================================
--- perl/modperl/branches/threading/Changes (original)
+++ perl/modperl/branches/threading/Changes Tue Feb 14 20:09:12 2012
@@ -37,6 +37,16 @@ Expose modperl_interp_t via ModPerl::Int
=item 2.0.6-dev
+Fix a few REFCNT bugs.
+Patch submitted by: Niko Tyni <nt...@debian.org>
+Reviewed by: Torsten Foertsch
+
+Correct the initialization of the build config in ModPerl::MM. The global
+variable was only being set once on loading the module, which was before
+Apache2::BuildConfig.pm had been written, leading to cwd and MP_LIBNAME
+being unset when writing the Reload and SizeLimit makefiles.
+[Steve Hay]
+
Discover apr-2-config from Apache 2.4 onwards. [Gozer]
Apache 2.4 and onwards doesn't require linking the MPM module directly in
Modified: perl/modperl/branches/threading/lib/ModPerl/MM.pm
URL: http://svn.apache.org/viewvc/perl/modperl/branches/threading/lib/ModPerl/MM.pm?rev=1244196&r1=1244195&r2=1244196&view=diff
==============================================================================
--- perl/modperl/branches/threading/lib/ModPerl/MM.pm (original)
+++ perl/modperl/branches/threading/lib/ModPerl/MM.pm Tue Feb 14 20:09:12 2012
@@ -70,10 +70,12 @@ sub add_dep_after {
$$string =~ s/($targ\s+::.*?$after_targ)/$1 $add/;
}
+my $build;
+
sub build_config {
my $key = shift;
require Apache2::Build;
- my $build = Apache2::Build->build_config;
+ $build ||= Apache2::Build->build_config;
return $build unless $key;
$build->{$key};
}
@@ -98,15 +100,14 @@ sub my_import {
my @default_opts = qw(CCFLAGS LIBS INC OPTIMIZE LDDLFLAGS TYPEMAPS);
my @default_dlib_opts = qw(OTHERLDFLAGS);
my @default_macro_opts = ();
-my $b = build_config();
my %opts = (
- CCFLAGS => sub { $b->{MODPERL_CCOPTS} },
- LIBS => sub { join ' ', $b->apache_libs, $b->modperl_libs },
- INC => sub { $b->inc; },
- OPTIMIZE => sub { $b->perl_config('optimize'); },
- LDDLFLAGS => sub { $b->perl_config('lddlflags'); },
- TYPEMAPS => sub { $b->typemaps; },
- OTHERLDFLAGS => sub { $b->otherldflags; },
+ CCFLAGS => sub { $build->{MODPERL_CCOPTS} },
+ LIBS => sub { join ' ', $build->apache_libs, $build->modperl_libs },
+ INC => sub { $build->inc; },
+ OPTIMIZE => sub { $build->perl_config('optimize'); },
+ LDDLFLAGS => sub { $build->perl_config('lddlflags'); },
+ TYPEMAPS => sub { $build->typemaps; },
+ OTHERLDFLAGS => sub { $build->otherldflags; },
);
sub get_def_opt {
@@ -129,7 +130,7 @@ sub WriteMakefile {
$eu_mm_mv_all_methods_overriden++;
}
- my $build = build_config();
+ $build ||= build_config();
my_import(__PACKAGE__);
# set top-level WriteMakefile's values if weren't set already
@@ -159,7 +160,7 @@ sub WriteMakefile {
sub ModPerl::MM::MY::post_initialize {
my $self = shift;
- my $build = build_config();
+ $build ||= build_config();
my $pm = $self->{PM};
while (my ($k, $v) = each %PM) {
Modified: perl/modperl/branches/threading/src/modules/perl/modperl_const.c
URL: http://svn.apache.org/viewvc/perl/modperl/branches/threading/src/modules/perl/modperl_const.c?rev=1244196&r1=1244195&r2=1244196&view=diff
==============================================================================
--- perl/modperl/branches/threading/src/modules/perl/modperl_const.c (original)
+++ perl/modperl/branches/threading/src/modules/perl/modperl_const.c Tue Feb 14 20:09:12 2012
@@ -51,7 +51,7 @@ static void new_constsub(pTHX_ constants
gv_init(alias, caller_stash, name, name_len, TRUE);
}
- GvCV_set(alias, GvCV(*gvp));
+ GvCV_set(alias, MUTABLE_CV(SvREFCNT_inc(GvCV(*gvp))));
}
}
Modified: perl/modperl/branches/threading/src/modules/perl/modperl_perl.c
URL: http://svn.apache.org/viewvc/perl/modperl/branches/threading/src/modules/perl/modperl_perl.c?rev=1244196&r1=1244195&r2=1244196&view=diff
==============================================================================
--- perl/modperl/branches/threading/src/modules/perl/modperl_perl.c (original)
+++ perl/modperl/branches/threading/src/modules/perl/modperl_perl.c Tue Feb 14 20:09:12 2012
@@ -55,7 +55,8 @@ void modperl_perl_core_global_init(pTHX)
while (cglobals->name) {
GV *gv = gv_fetchpv(cglobals->core_name, TRUE, SVt_PVCV);
- GvCV_set(gv, get_cv(cglobals->sub_name, TRUE));
+ GvCV_set(gv,
+ MUTABLE_CV(SvREFCNT_inc(get_cv(cglobals->sub_name, TRUE))));
GvIMPORTED_CV_on(gv);
cglobals++;
}