Bug 4300 - Assertion fails in "cairo-font.c" when using multithreads
Summary: Assertion fails in "cairo-font.c" when using multithreads
Status: RESOLVED DUPLICATE of bug 4299
Alias: None
Product: cairo
Classification: Unclassified
Component: image backend (show other bugs)
Version: 1.0.0
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-30 01:34 UTC by Alexey Shabalin
Modified: 2005-08-29 12:24 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Alexey Shabalin 2005-08-30 01:34:50 UTC
I got an error message from my Java application that using Cairo:
"cairo-font.c:788: cairo_scaled_font_reference: Assertion `i < font_map-
>num_holdovers' failed."
This error is generated when I'm using libcairo release 1.0.0.

If using older libcairo build (0.4.0) I got another messages:
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0xA9ACB346
Function=pixman_region_num_rects+0x12
Library=../../Bin/libpixman.so.1
-----------------------------------
java: cairo_ft_font.c:402: _ft_unscaled_font_unlock_face: Assertion `unscaled-
>lock > 0' failed.
-----------------
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0xA9BBFA01
Function=FcFontSetMatch+0x241
Library=/usr/lib/libfontconfig.so.1
-------------------------------------
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x9393781
Function=[Unknown.]
Library=(N/A)

I switched my application to single-thread mode all is working fine.
If I put a lock on call of svg_renderer in my code the crash disappear too.

This is a part of my code:

"
void svg2image(NavMapImage *src, NavMapImage *target, cairo_format_t format, 
               void (*write_fn)(char * buffer, int width, int height, 
NavMapImage *target)
               ){
    unsigned int svg_width, svg_height;


    CAIRO_MUTEX_DECLARE(my_cairo_mutex);
    
    svg_cairo_status_t status;
    cairo_t *cr;
    svg_cairo_t *svgc;
    cairo_surface_t *surface;

    status = svg_cairo_create (&svgc);

    if (status) {
	    fprintf (stderr, "Failed to create svg_cairo_t. Exiting.\n");
	    return;
    }

        status = svg_cairo_parse_buffer(svgc, src->data, src->size);
        if (status)
	        return;

        svg_cairo_get_size (svgc, &svg_width, &svg_height);
        int stride;

        switch(format) {
            case CAIRO_FORMAT_A1:
                stride = svg_width / 8;
                break;
            case CAIRO_FORMAT_A8:
                stride = svg_width;
                break;
            case CAIRO_FORMAT_RGB24:
            case CAIRO_FORMAT_ARGB32:
            default:
                stride = CAIRO_BPP * svg_width;
        }   

        char * image_buf = (char *) malloc (stride * svg_height);

        surface = cairo_image_surface_create_for_data ((unsigned char *) 
image_buf, format, svg_width, svg_height, stride);
            cr = cairo_create (surface);
  
            /// XXX: This probably doesn't need to be here (eventually) 
                cairo_set_source_rgb (cr, 1, 1, 1);

                CAIRO_MUTEX_LOCK(my_cairo_mutex);
                    status = svg_cairo_render (svgc, cr);
                CAIRO_MUTEX_UNLOCK(my_cairo_mutex);

            cairo_destroy (cr);
        
        cairo_surface_destroy(surface);

    svg_cairo_destroy (svgc);
   
     // call function to write image to corresponding format
    (*write_fn) (image_buf, svg_width, svg_height, target);

    free (image_buf);
}
"
Comment 1 Owen Taylor 2005-08-30 05:24:41 UTC

*** This bug has been marked as a duplicate of 4299 ***


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.