xslate / p5-Mouse

Lightweight class builder for Perl, as a subset of Moose
https://metacpan.org/release/Mouse
Other
46 stars 32 forks source link

Segmentation fault occurs when using MouseX::Foreign and role->apply at the same time #100

Closed ken39arg closed 5 years ago

ken39arg commented 5 years ago

it failed by segmentation fault when run this script by Mouse >= 2.3.0

use strict;
use warnings;

{
    package Simple;

    sub foo { 1 }
}

{
    package MyAdditionalRole;
    use Mouse::Role;

    sub added { 1 }

    no Mouse::Role;
}

{
    package MyClass;

    use Mouse;
    use MouseX::Foreign 'Simple';
}

sub test {
    my $obj = MyClass->new();
    MyAdditionalRole->meta->apply($obj);
    return;
}

test();

and Segmentation fault occurs in the this places. https://github.com/gfx/p5-Mouse/blob/318408ab5c5375c5d1a18f018c9cf59ecb548176/lib/Mouse/Meta/Module.pm#L289-L290 Maybe due to this change. https://github.com/gfx/p5-Mouse/compare/2.2.0...2.3.0#diff-e26c8c9cce35421fe9115643de112245R61