diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-12-06 13:20:03 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-12-06 13:20:03 +0300 |
commit | 1e45289f918df3e291ab7eb67d995766943a075c (patch) | |
tree | 08095e0ec704b2cb5cae768d7c5eccfcfded2bb3 /source/blender/blenkernel | |
parent | ac6efff0d7fce56553244d9cd6f0c3e989bb953c (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 3d565c2a5a3..c87c75b0190 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -874,12 +874,14 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstrain /* 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 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstrain } \ \ 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 @@ static void kinematic_flush_tars (bConstraint *con, ListBase *list, short nocopy /* 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) } } |