"double free or corruption" error appeares while i try to draw dotted line
Submitted by Sergey Pevzner
Assigned to Chris Wilson @ickle
Description
/*
"double free or corruption" error appeares while i try to draw dotted line
in case I comment line:
cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
or change antialias type to CAIRO_ANTIALIAS_BEST
- all work properly
*/
#include<cstdio>
#include<cairo/cairo.h>
int main() { cairo_surface_t *surface; cairo_t *cr; surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 256, 256); cr = cairo_create(surface);
cairo_set_source_rgba(cr, 0, 0, 0, 1);
cairo_paint(cr);
cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);
cairo_new_path(cr);
cairo_move_to(cr, 100, 251);
cairo_line_to(cr, 100, 196);
cairo_move_to(cr, 36, 3);
cairo_line_to(cr, 107, 3);
cairo_set_antialias(cr, CAIRO_ANTIALIAS_FAST);
cairo_set_tolerance(cr, 1);
double dsh[2] = {1,3};
cairo_set_dash(cr, dsh, 2, 0);
cairo_set_source_rgba(cr, 1, 1, 1, 1);
cairo_set_line_width(cr, 2);
cairo_stroke(cr);
cairo_destroy (cr);
cairo_surface_write_to_png (surface, "hello.png");
cairo_surface_destroy (surface);
return 0;
}
Version: 1.12.16