Subject: | Captured slot lexicals in inner anon `sub`s cause compiletime segfault |
Unmodified code works fine.
With this modification it segfaults at compiletime:
$ perl -c lib/Tickit/Widget/Choice.pm
Segmentation fault
=== modified file 'lib/Tickit/Widget/Choice.pm'
--- old/lib/Tickit/Widget/Choice.pm 2020-03-27 15:29:09 +0000
+++ new/lib/Tickit/Widget/Choice.pm 2020-03-27 15:31:18 +0000
@@ -218,15 +218,17 @@
=cut
+has $_menu;
+
method popup_menu
{
- my $menu = $self->{menu} = Tickit::Widget::Menu->new(
+ my $menu = $_menu = Tickit::Widget::Menu->new(
items => [ map {
my ( $value, $caption ) = @$_;
Tickit::Widget::Menu::Item->new(
name => $caption,
on_activate => sub {
- undef $self->{menu};
+ undef $_menu;
$self->choose_by_value( $value );
},
)
--
Paul Evans