SegFault with GnomeCanvas (Polygon)



    Hello,

When using the Polygon item in a GnomeCanvas (with the "aa" option ON : it's
about using libart instead of GDK to draw, I think...) we are getting a
segmentation fault after having changing a few times the fill and borderline
color of this object.
We are changing the colors each time the user "select" a polygon. We are
using the following code to create and change the color of a polygon :

  gtkRoot = gnome_canvas_root(GNOME_CANVAS(cnvDrawableObject));
  gtkPoints = gnome_canvas_points_new(4);

  gtkPoints->coords[0] = (ast_double)aPointPxlBG.lX;
  gtkPoints->coords[1] = (ast_double)aPointPxlBG.lY;
  gtkPoints->coords[2] = (ast_double)aPointPxlBD.lX;
  gtkPoints->coords[3] = (ast_double)aPointPxlBD.lY;
  gtkPoints->coords[4] = (ast_double)aPointPxlHG.lX;
  gtkPoints->coords[5] = (ast_double)aPointPxlHG.lY;
  gtkPoints->coords[6] = (ast_double)aPointPxlHD.lX;
  gtkPoints->coords[7] = (ast_double)aPointPxlHD.lY;

  gtkGfxItem = gnome_canvas_item_new
   (
    gtkRoot,
    gnome_canvas_polygon_get_type(),
    "points",    gtkPoints,
    "fill_color_rgba",  0xAFCAE980,
    "outline_color_rgba",  0xAFCAE9FF,
    "width_pixels",   TAGR_LINE_WIDTH,
    NULL
   );


And to change the color :
    gnome_canvas_item_set
      (
       gtkGfxItem,
       "fill_color_rgba",    iFillColor,
       "outline_color_rgba",  iOutlineColor,
       NULL
      );
/* With iFillColor and iOutlineColor two gint32 numbers representing the
selection color */

After a few selection (about 1à different ones) we're getting a segmentation
fault when executing the change color `gnome_canvas_item_set'

NB: If I change the item for another form (rectangular or ellipse have been
tryed) there is no problem! Why we are not changing to those items is
because it will not represent anymore what it should be, we need to use
polygons.



Best regards,
---
Jean-Christophe Berthon





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]