I'm porting an application from Gtk2/Gnome2::Canvas to Gtk3/GooCanvas2.
Most of the process has gone relatively smoothly, but I have hit
segmentation faults when calling the GooCanvas2 transform methods.

Calling the set_transform method on a canvas item results in
"ERROR:gperl-i11n-marshal-struct.c:119:sv_to_struct: assertion failed:
(package)".

Code to reproduce is below (adapted from the GooCanvas2 module synopsis).

I've also reported this to RT, but have yet to get a response from the
module author.
https://rt.cpan.org/Public/Bug/Display.html?id=133659


Is this something that can be fixed in the perl bindings?  Or is the issue
deeper?

FWIW, I can reproduce on Windows (Strawberry perl 5.28.0, using PPMs from
Sisyphusion.tk), and on Centos (perlbrew 5.30).

Thanks,
Shawn.


====

use strict;
use warnings;
use 5.022;

local $| = 1;

use Gtk3 -init;
use GooCanvas2;

my $window = Gtk3::Window->new();
$window->set_default_size(640, 600);
$window->signal_connect('destroy' => sub {Gtk3->main_quit()});

my $scrolled_win = Gtk3::ScrolledWindow->new();
$scrolled_win->set_shadow_type('in');

my $canvas = GooCanvas2::Canvas->new();
$canvas->set_size_request(600,450);
$canvas->set_bounds(0,0,1000,1000);
$scrolled_win->add($canvas);

my $root = $canvas->get_root_item();

my $rect_item = GooCanvas2::CanvasRect->new(
    'parent' => $root,
    'x' => 100,
    'y' => 100,
    'width' => 300,
    'height' => 400,
    'line_width' => 10.0,
    'radius-x' => 20.0,
    'radius-y' => 10.0,
    'stroke-color' => 'yellow',
    'fill-color' => 'red',
);


my $mx = Cairo::Matrix->init (1, 0, 0, 1, 1, 1);

#  this fails
my $tfm = eval {
    $rect_item->set_transform ($mx);
};
say $@ if $@;

say 'Getting transform';
my (@tt) = eval {
    $rect_item->get_transform;
};
say $@ if $@;

say join ' ', map {$_ // 'undef'} @tt;

# Connect a signal handler for the rectangle item.
$rect_item->signal_connect('button_press_event' => \&on_rect_button_press);

$window->add($scrolled_win);
$window->show_all;

# Pass control to the Gtk3 main event loop
Gtk3->main();

# This handles button presses in item views.
#We simply output a message to the console
sub on_rect_button_press {
    my ($item, $target, $event) = @_;
    print "rect item received button press event \n";
    return 1;
}
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to