diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | urpm/install.pm | 8 |
2 files changed, 9 insertions, 2 deletions
@@ -1,3 +1,6 @@ +- fix a circular reference that was causing rpmdb to be opened many + times in installer + Version 6.22.4 - 9 March 2009 - change installer API (in order to fix detecting whether installing ackages diff --git a/urpm/install.pm b/urpm/install.pm index c57688b6..4faab2db 100644 --- a/urpm/install.pm +++ b/urpm/install.pm @@ -224,17 +224,21 @@ sub install { my $fh; #- assume default value for some parameter. $options{delta} ||= 1000; + + #- ensure perl does not create a circular reference below, otherwise all this won't be collected, + # and rpmdb won't be closed: + my ($callback_open_helper, $callback_close_helper) = ($options{callback_open_helper}, $options{callback_close_helper}); $options{callback_open} = sub { my ($_data, $_type, $id) = @_; $index++; - $options{callback_open_helper} and $options{callback_open_helper}->(@_); + $callback_open_helper and $callback_open_helper->(@_); $fh = urpm::sys::open_safe($urpm, '<', $install->{$id} || $upgrade->{$id}); $fh ? fileno $fh : undef; }; $options{callback_close} = sub { my ($urpm, undef, $pkgid) = @_; return unless defined $pkgid; - $options{callback_close_helper} and $options{callback_close_helper}->($db, @_); + $callback_close_helper and $callback_close_helper->($db, @_); get_README_files($urpm, $trans, $urpm->{depslist}[$pkgid]); close $fh if defined $fh; }; |