Bugfix #16673: Segfault when using Bake Constraints Script

There were several buggy things here (in order of significance):
1) PyAPI method didn't check to make sure that there was an active posechannel when deleting posechannel constraints. This was required by constraint_active_func() to be able to update the 'active' flags for the constraints in that stack
2) PyAPI method removed the links to the constraint data from the constraints list, even though that wasn't necessary, and may have caused memory leaks. 
3) constraint_active_func() had no error checking for no constraints-stack being found
This commit is contained in:
2008-08-05 03:29:46 +00:00
parent 07bc1e56fe
commit 9e968cea47
2 changed files with 24 additions and 8 deletions

View File

@@ -173,6 +173,7 @@ static void constraint_active_func(void *ob_v, void *con_v)
}
lb= get_active_constraints(ob);
if (lb == NULL) return;
for(con= lb->first; con; con= con->next) {
if(con==con_v) con->flag |= CONSTRAINT_ACTIVE;
@@ -307,7 +308,7 @@ void del_constr_func (void *ob_v, void *con_v)
}
/* remove constraint itself */
lb= get_active_constraints(ob_v);
free_constraint_data (con);
free_constraint_data(con);
BLI_freelinkN(lb, con);
constraint_active_func(ob_v, NULL);