about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiMark.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-23 11:48:08 +0000
committerEric Wong <e@80x24.org>2021-03-24 01:33:26 +0000
commit97caa1fe259cd6904573f36e0ac078a269b6ec5f (patch)
tree1babb08442553884028f9177ce471188fbfd5c76 /lib/PublicInbox/LeiMark.pm
parentd39ff2cf4400b87bf6f51d7fe9f4b0e2a72bf679 (diff)
downloadpublic-inbox-97caa1fe259cd6904573f36e0ac078a269b6ec5f.tar.gz
Instead of creating a short-lived circular reference,
ensure they don't exist in the first place.

Note the following changes to hold an extra ref to $sto:

	-	$self->_lei_store(1)->write_prepare($self);
	+	my $sto = $self->_lei_store(1);
	+	$sto->write_prepare($self);

I'm not a perlguts expert, but I actually wanted to switch
to the one-line version for LeiImport, but xt/lei-auth-fail.t
was getting stuck for some reason.  It seems the extra ref
to the LeiStore ($sto) object is necessary.
Diffstat (limited to 'lib/PublicInbox/LeiMark.pm')
-rw-r--r--lib/PublicInbox/LeiMark.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/PublicInbox/LeiMark.pm b/lib/PublicInbox/LeiMark.pm
index 3b5e6c2c..9d77f4b4 100644
--- a/lib/PublicInbox/LeiMark.pm
+++ b/lib/PublicInbox/LeiMark.pm
@@ -105,8 +105,8 @@ sub input_net_cb { # imap_each, nntp_each cb
 sub lei_mark { # the "lei mark" method
         my ($lei, @argv) = @_;
         my $sto = $lei->_lei_store(1);
-        my $self = $lei->{mark} = bless { missing => 0 }, __PACKAGE__;
         $sto->write_prepare($lei);
+        my $self = bless { missing => 0 }, __PACKAGE__;
         $lei->ale; # refresh and prepare
         my $vmd_mod = vmd_mod_extract(\@argv);
         return $lei->fail(join("\n", @{$vmd_mod->{err}})) if $vmd_mod->{err};