Subject: | Expose events can be called on windows that have already gone out of scope |
I think this one needs a proper test case to confirm the behaviour I'm seeing, but:
$event_ids->{expose} = $window->bind_event( expose => sub {
my ( $win, undef, $info ) = @_;
$win->is_visible or return;
$info->rb->setpen( $self->{pen} );
$self->render_to_rb( $info->rb, $info->rect );
});
That $win->is_visible check can fail with this:
Error: Can't call method "is_visible" on an undefined value at .../Tickit/Widget.pm line 526.
which I think was triggered by this:
my $win = ...temporary window with refcount 1...;
$tickit->later(sub { $win->expose }); # immediately after the ->expose call, $win goes out of scope so the window refcount drops to zero
Changing that line to check for '$win && $win->is_visible' instead seems to be enough to fix it.