[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11377] branches/2-44-stable/blender/ source/blender/python/api2_2x/Curve.c: retarded method of adding an item to a linked list that used pointer tricks but only set the last items - >next and not the linked lists ->last.

Campbell Barton cbarton at metavr.com
Thu Jul 26 16:04:40 CEST 2007


Revision: 11377
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11377
Author:   campbellbarton
Date:     2007-07-26 16:04:40 +0200 (Thu, 26 Jul 2007)

Log Message:
-----------
retarded method of adding an item to a linked list that used pointer tricks but only set the last items ->next and not the linked lists ->last.
solved by using BLI_addtail()

this fixed joining python created curves that meant imported svg's would crash when joining.

fixes bug #6820 - http://projects.blender.org/tracker/index.php?func=detail&aid=6820&group_id=9&atid=125

Modified Paths:
--------------
    branches/2-44-stable/blender/source/blender/python/api2_2x/Curve.c

Modified: branches/2-44-stable/blender/source/blender/python/api2_2x/Curve.c
===================================================================
--- branches/2-44-stable/blender/source/blender/python/api2_2x/Curve.c	2007-07-26 13:38:24 UTC (rev 11376)
+++ branches/2-44-stable/blender/source/blender/python/api2_2x/Curve.c	2007-07-26 14:04:40 UTC (rev 11377)
@@ -1,4 +1,4 @@
-/* 
+/*  
  * $Id$
  *
  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
@@ -32,6 +32,7 @@
 
 #include "Curve.h" /*This must come first*/
 
+#include "BLI_blenlib.h"
 #include "BKE_main.h"
 #include "BKE_displist.h"
 #include "BKE_global.h"
@@ -880,27 +881,14 @@
 
 static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * value )
 {
-	Nurb *nurb_ptr = self->curve->nurb.first;
-	Nurb **pptr = ( Nurb ** ) & ( self->curve->nurb.first );
 	Nurb *new_nurb;
-
-
-	/* walk to end of nurblist */
-	if( nurb_ptr ) {
-		while( nurb_ptr->next ) {
-			nurb_ptr = nurb_ptr->next;
-		}
-		pptr = &nurb_ptr->next;
-	}
-
 	/* malloc new nurb */
 	new_nurb = ( Nurb * ) MEM_callocN( sizeof( Nurb ), "appendNurb" );
 	if( !new_nurb )
 		return EXPP_ReturnPyObjError
 			( PyExc_MemoryError, "unable to malloc Nurb" );
-
+	
 	if( CurNurb_appendPointToNurb( new_nurb, value ) ) {
-		*pptr = new_nurb;
 		new_nurb->resolu = self->curve->resolu;
 		new_nurb->resolv = self->curve->resolv;
 		new_nurb->hide = 0;
@@ -927,6 +915,7 @@
 			new_nurb->knotsu = 0;
 			/*makenots( new_nurb, 1, new_nurb->flagu >> 1); */
 		}
+		BLI_addtail( &self->curve->nurb, new_nurb);
 
 	} else {
 		freeNurb( new_nurb );





More information about the Bf-blender-cvs mailing list