Bug 4995

Summary: Segfault with statc build on Win32
Product: cairo Reporter: Christoph Bauer <Christoph.Bauer>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: critical    
Priority: high    
Version: 1.0.3   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:

Description Christoph Bauer 2005-11-09 06:39:16 UTC
Hi,

I took from the FAQ this program:

#include <cairo.h>
int
main (int argc, char *argv[]) {
        cairo_surface_t *surface;
        surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 200, 100);
        cairo_t *cr;
        cr = cairo_create (surface);
        cairo_select_font_face (cr, "Serif", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD);
        cairo_set_font_size (cr, 32.0);
        cairo_set_source_rgba (cr, 0.0, 0.3, 1.0, 1.0);
        cairo_move_to (cr, 10.0, 50.0);
        cairo_show_text (cr, "Hello World");
        cairo_destroy (cr);
        cairo_surface_write_to_png (surface, "hw.png");
        cairo_surface_destroy (surface);
        return 0;
}

and get with the latest CVS cairo this:

Program received signal SIGSEGV, Segmentation fault.
0x7788f281 in ?? ()
(gdb) where
#0  0x7788f281 in ?? ()
#1  0x77887f26 in ?? ()
#2  0x004145c7 in _cairo_toy_font_face_create (family=0x437000 "Serif", 
    slant=CAIRO_FONT_SLANT_NORMAL, weight=CAIRO_FONT_WEIGHT_BOLD)
    at ../../src/cairo-font.c:336
#3  0x00412c80 in _cairo_gstate_select_font_face (gstate=0xa12d50, 
    family=0x437000 "Serif", slant=CAIRO_FONT_SLANT_NORMAL, 
    weight=CAIRO_FONT_WEIGHT_BOLD) at ../../src/cairo-gstate.c:1683
#4  0x004059a7 in cairo_select_font_face (cr=0xa12be8, 
    family=0x437000 "Serif", slant=CAIRO_FONT_SLANT_NORMAL, 
    weight=CAIRO_FONT_WEIGHT_BOLD) at ../../src/cairo.c:1805
#5  0x0040135a in main (argc=1, argv=0xa14f48) at hw.c:8

regards,
Christoph Bauer
Comment 1 Christoph Bauer 2005-11-09 06:40:15 UTC
cairo was compiled with mingw-gcc
Comment 2 Christoph Bauer 2005-11-09 08:38:26 UTC
I think my bug is a duplicate of #4692.

Without fonts cairo seems to work, even in my Tk-Cairo Widget/Win32-Backend :-)
Comment 3 Vladimir Vukicevic 2005-11-09 15:03:00 UTC
Yep, almost certainly a dup of bug 4692 .  Can you try with a non-static build,
or manually do some code munging to get the things initialized?  (I'd pull out
initializer code into a cairo_win32_init() or something temporarily.)
Comment 4 Christoph Bauer 2005-11-11 03:47:50 UTC
configure --help should mention, that --enable-shared is supported (but not default)

Yes, the dynamic build looks better:

a8-mask is expected to fail:
        image backend fails because libpixman only handles (stride %
sizeof(pixman_bits) == 0)
a8-mask-image-argb32:   XFAIL
a8-mask-image-rgb24:    XFAIL
XFAIL: a8-mask

caps-joins-image-argb32:        PASS
caps-joins-image-rgb24: PASS
PASS: caps-joins

caps-sub-paths-image-argb32:    PASS
caps-sub-paths-image-rgb24:     PASS
PASS: caps-sub-paths

clip-all-image-argb32:  PASS
clip-all-image-rgb24:   PASS
PASS: clip-all

clip-fill-rule-image-argb32:    PASS
clip-fill-rule-image-rgb24:     PASS
PASS: clip-fill-rule

clip-fill-rule-pixel-aligned-image-argb32:      PASS
clip-fill-rule-pixel-aligned-image-rgb24:       PASS
PASS: clip-fill-rule-pixel-aligned

clip-nesting-image-argb32:      PASS
clip-nesting-image-rgb24:       PASS
PASS: clip-nesting

Then it hangs.
Comment 5 joachim 2007-03-21 01:19:42 UTC
Use:
surface = cairo_win32_surface_create_with_dib();
instead of:
surface = cairo_image_surface_create();

Otherwise, it seems _cairo_win32_initialize() is not called in static builds.
Comment 6 Chris Wilson 2008-10-10 16:00:59 UTC
How is the static win32 build fairing after the Great Mutex Upheaval of 2007 and the Build Revamp of 2008?
Comment 7 GitLab Migration User 2018-08-25 13:44:00 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/166.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.