From 0037b51dcc6900db62a1c2a6b935c0c23329bb65 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 28 Nov 2003 13:33:08 +0000 Subject: * (Coords): When replacing all the coordinates of a curve, the control point list was not correctly updated. --- generic/Curve.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'generic') diff --git a/generic/Curve.c b/generic/Curve.c index 202e0ce..901f331 100644 --- a/generic/Curve.c +++ b/generic/Curve.c @@ -1842,11 +1842,15 @@ Coords(ZnItem item, if (c->points) { ZnFree(c->points); } - c->points = (ZnPoint *) ZnMalloc(*num_pts*sizeof(ZnPoint)); + c->points = ZnMalloc(*num_pts*sizeof(ZnPoint)); c->num_points = *num_pts; memcpy(c->points, *pts, *num_pts*sizeof(ZnPoint)); + if (c->controls) { + ZnFree(c->controls); + c->controls = NULL; + } if (*controls) { - c->controls = ZnRealloc(c->controls, *num_pts*sizeof(char)); + c->controls = ZnMalloc(*num_pts*sizeof(char)); memcpy(c->controls, *controls, *num_pts*sizeof(char)); } } -- cgit v1.1