]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
lei_saved_search: don't create Git object during ->DESTROY
authorEric Wong <e@80x24.org>
Wed, 22 Nov 2023 21:24:11 +0000 (21:24 +0000)
committerEric Wong <e@80x24.org>
Wed, 22 Nov 2023 22:16:36 +0000 (22:16 +0000)
This fixes t/lei-q-save.t getting stuck since $self->{ale} is
already gone by the time DESTROY gets called.

lib/PublicInbox/LeiSavedSearch.pm

index 2811c46dc03ac27ad905473fe850e5c8eb33faae..9ae9dcdb4bc68862b8e09c76d5b90b3718a1a981 100644 (file)
@@ -245,10 +245,10 @@ sub git { $_[0]->{git} //= PublicInbox::Git->new($_[0]->{ale}->git->{git_dir}) }
 
 sub pause_dedupe {
        my ($self) = @_;
-       git($self)->cleanup;
-       my $lockfh = delete $self->{lockfh}; # from lock_for_scope_fast;
-       my $oidx = delete($self->{oidx}) // return;
-       $oidx->commit_lazy;
+       my ($git, $oidx) = delete @$self{qw(git oidx)};
+       $git->cleanup if $git;
+       $oidx->commit_lazy if $oidx;
+       delete $self->{lockfh}; # from lock_for_scope_fast;
 }
 
 sub reset_dedupe {