diff options
author | Joshua Leung <aligorith@gmail.com> | 2014-11-29 14:08:14 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2014-11-29 14:08:14 +0300 |
commit | ca98aca565774afc524b7b1ba505196574ce5091 (patch) | |
tree | 27fdaa5838291342bbda3b8a1e45972b32486259 /source | |
parent | defd3a6ebf97ee24ba80d2b242e045fbacd13886 (diff) |
Quick hacky fix for crash on undo (for Grease Pencil)
AnimData is not copied when making duplicating bGPdata for internal usage
(i.e. for the undo buffer); instead, the data was being shared between the
real copies and the undo buffer copies (to save memory - since otherwise
we'd have to have copies of all the animation data floating around).
The fix here clears these refs before trying to free these copies,
making sure that the data won't get freed incorrectly.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_undo.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c index 9a71c65c105..b1bbeabbd55 100644 --- a/source/blender/editors/gpencil/gpencil_undo.c +++ b/source/blender/editors/gpencil/gpencil_undo.c @@ -133,7 +133,12 @@ void gpencil_undo_push(bGPdata *gpd) while (undo_node) { bGPundonode *next_node = undo_node->next; - + + /* HACK: animdata wasn't duplicated, so it shouldn't be freed here, + * or else the real copy will segfault when accessed + */ + undo_node->gpd->adt = NULL; + BKE_gpencil_free(undo_node->gpd); MEM_freeN(undo_node->gpd); @@ -157,6 +162,11 @@ void gpencil_undo_finish(void) bGPundonode *undo_node = undo_nodes.first; while (undo_node) { + /* HACK: animdata wasn't duplicated, so it shouldn't be freed here, + * or else the real copy will segfault when accessed + */ + undo_node->gpd->adt = NULL; + BKE_gpencil_free(undo_node->gpd); MEM_freeN(undo_node->gpd); |