timo / cairo-p6

A NativeCall binding to the Cairo 2d graphics library for Perl 6
10 stars 7 forks source link

Segmentation fault (core dumped) on Cairo::Surface::PDF.show_page() #37

Open wayland opened 3 months ago

wayland commented 3 months ago

Hi! I get a Segfault as follows:

$ raku -e 'use Cairo; my $surface = Cairo::Surface::PDF.new(filename => "file.pdf", :width(1683e0), :height(2383e0)); $surface.show_page()'
Segmentation fault (core dumped)

Versions:

$ raku --version
Welcome to Rakudo™ v2022.04.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2022.04.

$ rpm -qa | grep -i cairo | sort | ack -v i686
cairo-1.17.6-1.fc36.x86_64
cairo-devel-1.17.6-1.fc36.x86_64
cairo-gobject-1.17.6-1.fc36.x86_64
cairo-gobject-devel-1.17.6-1.fc36.x86_64
cairomm-1.14.2-22.fc36.x86_64

HTH,

dwarring commented 3 months ago

Have fixed. Your example should work, without seg-faulting with Cairo v0.3.5. Although it still needs some content to be added to produce a valid PDF.

I've also changed Cairo::Surface::SVG and Cairo::Image, which had similar issues with the new method. These now work the same way.

For example:

   my $image1 = Cairo::Image.new(:width(256), :height(256));  # creates a new blank image
   my $image2 = Cairo::Image.new(:filename<doc/examples/camelia.png> ); # load existing image

Thanks, for the report.

wayland commented 3 months ago

Great! Yes, I know it needs content to be useful; I just went for the minimum to produce a segfault :) .

Good to hear that you picked up the other problems as well. I'll try it and see what I get.

Thanks!