From: mental Date: Tue, 9 May 2006 04:38:53 +0000 (+0000) Subject: always make local copy of path data so we have control of memory policy X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=016c69eca6f4b8a49961d6073a0c7935ab625d0c;p=inkscape.git always make local copy of path data so we have control of memory policy --- diff --git a/ChangeLog b/ChangeLog index 63842331b..e24114c86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,13 @@ containing connectors if they were loaded from the file chooser or from the recent file list. Fixes bug #1458820. +2006-05-08 MenTaLguY + + * src/display/curve.cpp: + + always make local copy of path data so that we have control over memory + policy + 2006-05-08 MenTaLguY * src/display/curve.h, src/display/curve.cpp, src/dropper-context.cpp: diff --git a/src/display/curve.cpp b/src/display/curve.cpp index aa899b902..3e491a2b8 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -79,32 +79,8 @@ sp_curve_new_from_bpath(NArtBpath *bpath) { g_return_val_if_fail(bpath != NULL, NULL); - if (!sp_bpath_good(bpath)) { - NArtBpath *new_bpath = sp_bpath_clean(bpath); - if (new_bpath == NULL) { - return NULL; - } - nr_free(bpath); - bpath = new_bpath; - } - - SPCurve *curve = g_new(SPCurve, 1); - - curve->refcount = 1; - curve->_bpath = bpath; - curve->length = sp_bpath_length(bpath); - curve->end = curve->length - 1; - gint i = curve->end; - for (; i > 0; i--) - if ((curve->_bpath[i].code == NR_MOVETO) || - (curve->_bpath[i].code == NR_MOVETO_OPEN)) - break; - curve->substart = i; - curve->hascpt = false; - curve->posSet = false; - curve->moving = false; - curve->closed = sp_bpath_closed(bpath); - + SPCurve *curve = sp_curve_new_from_foreign_bpath(bpath); + nr_free(bpath); return curve; } @@ -127,10 +103,22 @@ SPCurve *sp_curve_new_from_foreign_bpath(NArtBpath const bpath[]) memcpy(new_bpath, bpath, len * sizeof(NArtBpath)); } - SPCurve *curve = sp_curve_new_from_bpath(new_bpath); + SPCurve *curve = g_new(SPCurve, 1); - if (!curve) - nr_free(new_bpath); + curve->refcount = 1; + curve->_bpath = new_bpath; + curve->length = sp_bpath_length(new_bpath); + curve->end = curve->length - 1; + gint i = curve->end; + for (; i > 0; i--) + if ((curve->_bpath[i].code == NR_MOVETO) || + (curve->_bpath[i].code == NR_MOVETO_OPEN)) + break; + curve->substart = i; + curve->hascpt = false; + curve->posSet = false; + curve->moving = false; + curve->closed = sp_bpath_closed(new_bpath); return curve; }