[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12805] trunk/blender/source/blender/ blenkernel/intern/constraint.c: Constraints Bugfix:
bjornmose
bjornmose at gmx.net
Fri Dec 7 00:10:25 CET 2007
hi all,
may be i am becoming a grumpy old man,
BUT
i did a short late night test ..
this one segfaulted on a vanilla linux build .. only needed to turn on
the 'fake MS compilers to check possible abuse of invalid memory
pointers' ..
that is ./blender -d
may be developers should choose that option every now and then.
cheers to a-dam .. you are doing real great things right now .. and i
know 'shit happens'
anyhoo .. if threre a tools build in to check possible glitches .. i'd
suggest to use 'em
my 0.02 euro on that
BM
Joshua Leung schrieb:
> Revision: 12805
> http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12805
> Author: aligorith
> Date: 2007-12-06 11:20:03 +0100 (Thu, 06 Dec 2007)
>
> Log Message:
> -----------
> Constraints Bugfix:
>
> IK-constraint "flush_targets" function was causing segfaults on debug builds from certain MSVC compilers.
>
> The cause of this, is that ct is freed in the SINGLETARGET_FLUSH_TARS macro already, but ct is accessed in the following line to get the next target (ct= ct->next). Caused by brecht's commit for the pole-target stuff for IK-constraint.
>
> Now the SINGLETARGET_FLUSH_TARS macro, and the SINGLETARGETNS_FLUSH_TARS macro will correctly advance the location that ct points to.
>
> Modified Paths:
> --------------
> trunk/blender/source/blender/blenkernel/intern/constraint.c
>
> Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
> ===================================================================
> --- trunk/blender/source/blender/blenkernel/intern/constraint.c 2007-12-06 09:41:46 UTC (rev 12804)
> +++ trunk/blender/source/blender/blenkernel/intern/constraint.c 2007-12-06 10:20:03 UTC (rev 12805)
> @@ -874,12 +874,14 @@
>
> /* This following macro should be used for all standard single-target *_flush_tars functions
> * to save typing and reduce maintainance woes.
> + * Note: the pointer to ct will be changed to point to the next in the list (as it gets removed)
> * (Hopefully all compilers will be happy with the lines with just a space on them. Those are
> * really just to help this code easier to read)
> */
> #define SINGLETARGET_FLUSH_TARS(con, datatar, datasubtarget, ct, list, nocopy) \
> { \
> if (ct) { \
> + bConstraintTarget *ctn = ct->next; \
> if (nocopy == 0) { \
> datatar= ct->tar; \
> strcpy(datasubtarget, ct->subtarget); \
> @@ -887,23 +889,27 @@
> } \
> \
> BLI_freelinkN(list, ct); \
> + ct= ctn; \
> } \
> }
>
> /* This following macro should be used for all standard single-target *_flush_tars functions
> - * to save typing and reduce maintainance woes. It does not do the subtarget related operations
> + * to save typing and reduce maintainance woes. It does not do the subtarget related operations.
> + * Note: the pointer to ct will be changed to point to the next in the list (as it gets removed)
> * (Hopefully all compilers will be happy with the lines with just a space on them. Those are
> * really just to help this code easier to read)
> */
> #define SINGLETARGETNS_FLUSH_TARS(con, datatar, ct, list, nocopy) \
> { \
> if (ct) { \
> + bConstraintTarget *ctn = ct->next; \
> if (nocopy == 0) { \
> datatar= ct->tar; \
> con->tarspace= ct->space; \
> } \
> \
> BLI_freelinkN(list, ct); \
> + ct= ctn; \
> } \
> }
>
> @@ -1214,7 +1220,6 @@
>
> /* the following macro is used for all standard single-target constraints */
> SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
> - ct= ct->next;
> SINGLETARGET_FLUSH_TARS(con, data->poletar, data->polesubtarget, ct, list, nocopy)
> }
> }
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
>
>
More information about the Bf-committers
mailing list