[cairo] Cairo 1.8 crashes when creating PDF (OS X 10.5 PowerPC)

Asko Kauppi askok at dnainternet.net
Tue Dec 9 02:17:13 PST 2008


If you add 'cairo_show_text()' to the mix, the crash is there.

This one gives "Bus error", other circumstances can give "Segmentation  
fault".  Most likely it's the same issue, though (always within  
'cairo_show_text()'.

$ gcc `pkg-config cairo --cflags --libs` -o testme_c testme.c
$ ./testme_c
Bus error

$ uname -a
Darwin PowerBook-G4.dlan.fmi.fi 9.5.0 Darwin Kernel Version 9.5.0: Wed  
Sep  3 11:31:44 PDT 2008; root:xnu-1228.7.58~1/RELEASE_PPC Power  
Macintosh

$ gcc -v
Using built-in specs.
Target: powerpc-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5484~1/src/configure --disable- 
checking -enable-werror --prefix=/usr --mandir=/share/man --enable- 
languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/ 
$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/ 
lib --build=i686-apple-darwin9 --program-prefix= --host=powerpc-apple- 
darwin9 --target=powerpc-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5484)

$ pkg-config --modversion cairo
1.8.4

$ fink --version
Package manager version: 0.28.6


<<
#include <cairo.h>
#include <cairo-pdf.h>

int main ()
{
     cairo_surface_t *surface = cairo_pdf_surface_create("out_c.pdf",  
120, 120);
     cairo_t *cr = cairo_create (surface);
     cairo_arc(cr, 60, 60, 25, 0, 6.283);
     cairo_set_source_rgb(cr, 0.5, 0.6, 0.8);
     cairo_fill_preserve(cr);
     cairo_set_line_width(cr, 5.0);
     cairo_set_source_rgb(cr, 0.3, 0.4, 0.6);
     cairo_stroke(cr);

     cairo_move_to( cr, 60,60 );
     cairo_show_text( cr, "abc" );   // <--- BUS ERROR if gets here
     cairo_stroke(cr);

     cairo_destroy (cr);
     cairo_surface_destroy (surface);
}
<<

-asko


Paolo Bonzini kirjoitti 9.12.2008 kello 1:26:

> Asko Kauppi wrote:
>> I would like to use 1.8.x because of its nice Quartz integration, but
>> it gives either "segfault" or "bus error" when generating PDF files.
>
>> This has happened using two separate Lua bindings; I have not tried
>> with C level PDF creation, yet.
>
> Please try.  This for example works for me:
>
> #include <cairo.h>
> #include <cairo-pdf.h>
> int main ()
> {
>  cairo_surface_t *surface;
>  cairo_t *cr;
>
>  surface = cairo_pdf_surface_create ("hello.pdf", 120, 120);
>  cr = cairo_create (surface);
>  cairo_arc(cr, 60, 60, 25, 0, 6.283);
>  cairo_set_source_rgb(cr, 0.5, 0.6, 0.8);
>  cairo_fill_preserve(cr);
>  cairo_set_line_width(cr, 5.0);
>  cairo_set_source_rgb(cr, 0.3, 0.4, 0.6);
>  cairo_stroke(cr);
>  cairo_destroy (cr);
>  cairo_surface_destroy (surface);
> }
>
> Try it in C and with your two bindings.
>
> And since you are at it, could you try if you can reproduce
>
>   http://bugs.freedesktop.org/show_bug.cgi?id=18632
>
> on your setup?  I reported it but nobody confirmed it.
>
> Thanks!
>
> Paolo



More information about the cairo mailing list