Subject: | Segmentation fault in ->text_at with \n |
Finally managed to get a test case that triggers the segmentation fault issue mentioned a few times. This appears to be caused by the \n character, removing it from this test shows the lines as expected.
Stacktrace just indicates memcpy(), all other stack frames have been lost by the time the segfault occurs.
cheers,
Tom
Subject: | 2015-02-12-tickit-text_at-segfault.pl |
#!/usr/bin/env perl
use strict;
use warnings;
package Tickit::Widget::Segfault;
use parent qw(Tickit::Widget);
use Tickit::Style;
use constant WIDGET_PEN_FROM_STYLE => 1;
BEGIN {
style_definition base => ;
}
sub lines { 1 }
sub cols { 1 }
sub render_to_rb {
my ($self, $rb, $rect) = @_;
$rb->clip($rect);
$rb->clear;
my @lines = map "$_\n", qw(one two three four);
my $y = 0;
$rb->text_at($y++, 0, shift(@lines), $self->get_style_pen) while @lines;
}
package main;
use Tickit;
Tickit->new(
root => Tickit::Widget::Segfault->new(
)
)->run;