]> Sergey Matveev's repositories - public-inbox.git/commitdiff
viewvcs: avoid segfault with highlight.pm at shutdown
authorEric Wong <e@80x24.org>
Tue, 29 Jan 2019 21:35:25 +0000 (21:35 +0000)
committerEric Wong <e@80x24.org>
Tue, 29 Jan 2019 22:02:46 +0000 (22:02 +0000)
Proper ordering of destruction seems required to avoid segfaults
at shutdown.

lib/PublicInbox/ViewVCS.pm

index 63e503d8f33066df1593d360dbe7b1cb2a16264b..85edf22fb6ccd2000cbc107c74ceb4d0d052b0ef 100644 (file)
@@ -26,6 +26,11 @@ my $hl = eval {
        PublicInbox::HlMod->new;
 };
 
+# we need to trigger highlight::CodeGenerator::deleteInstance
+# in HlMod::DESTROY before the rest of Perl shuts down to avoid
+# a segfault at shutdown
+END { $hl = undef };
+
 my %QP_MAP = ( A => 'oid_a', B => 'oid_b', a => 'path_a', b => 'path_b' );
 my $max_size = 1024 * 1024; # TODO: configurable
 my $enc_utf8 = find_encoding('UTF-8');