diff options
Diffstat (limited to 'urpm/install.pm')
-rw-r--r-- | urpm/install.pm | 8 |
1 files changed, 6 insertions, 2 deletions
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; }; |