Fix for invalid memory access in graph editor when deleting the last

vertex in a fcurve.
This commit is contained in:
Lukas Tönne 2014-07-10 13:02:22 +02:00
parent 42615d88b6
commit 19f89a083f
3 changed files with 8 additions and 3 deletions

@ -364,12 +364,14 @@ void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data)
if (ale->update & ANIM_UPDATE_ORDER) { if (ale->update & ANIM_UPDATE_ORDER) {
ale->update &= ~ANIM_UPDATE_ORDER; ale->update &= ~ANIM_UPDATE_ORDER;
sort_time_fcurve(fcu); if (fcu)
sort_time_fcurve(fcu);
} }
if (ale->update & ANIM_UPDATE_HANDLES) { if (ale->update & ANIM_UPDATE_HANDLES) {
ale->update &= ~ANIM_UPDATE_HANDLES; ale->update &= ~ANIM_UPDATE_HANDLES;
calchandles_fcurve(fcu); if (fcu)
calchandles_fcurve(fcu);
} }
if (ale->update & ANIM_UPDATE_DEPS) { if (ale->update & ANIM_UPDATE_DEPS) {

@ -878,8 +878,10 @@ static bool delete_action_keys(bAnimContext *ac)
changed = delete_fcurve_keys(fcu); changed = delete_fcurve_keys(fcu);
/* Only delete curve too if it won't be doing anything anymore */ /* Only delete curve too if it won't be doing anything anymore */
if ((fcu->totvert == 0) && (list_has_suitable_fmodifier(&fcu->modifiers, 0, FMI_TYPE_GENERATE_CURVE) == 0)) if ((fcu->totvert == 0) && (list_has_suitable_fmodifier(&fcu->modifiers, 0, FMI_TYPE_GENERATE_CURVE) == 0)) {
ANIM_fcurve_delete_from_animdata(ac, adt, fcu); ANIM_fcurve_delete_from_animdata(ac, adt, fcu);
ale->key_data = NULL;
}
} }
if (changed) { if (changed) {

@ -907,6 +907,7 @@ static bool delete_graph_keys(bAnimContext *ac)
(fcu->driver == NULL)) (fcu->driver == NULL))
{ {
ANIM_fcurve_delete_from_animdata(ac, adt, fcu); ANIM_fcurve_delete_from_animdata(ac, adt, fcu);
ale->key_data = NULL;
} }
} }