Skip Menu |

This queue is for tickets about the Object-Pad CPAN distribution.

Report information
The Basics
Id: 132249
Status: resolved
Priority: 0/
Queue: Object-Pad

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.16
Fixed in: 0.17



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
Minimized test case attached. Worthy of note is the second, empty `method` - if I delete that the SEGV goes away. -- Paul Evans
Subject: Choice.pm
use Object::Pad 0.16; class Tickit::Widget::Choice; has $_menu; method popup_menu { my $on_activate = sub { undef $_menu; }; } method on_mouse { } 0x55AA;
On Fri Mar 27 14:04:51 2020, PEVANS wrote: Show quoted text
> Minimized test case attached. Worthy of note is the second, empty > `method` - if I delete that the SEGV goes away.
Turned out to be a complication of the way the single shared slot-pad was reused for every method. A better solution is to create a new pad for every method. This requires a new hook stage in XS::Parse::Sublike, and hence a new ABI version. So a whole round of module updates coming up ... -- Paul Evans