diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-01-07 16:13:37 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-01-07 16:14:19 +0300 |
commit | 94d19d5ff505af0b63085ec76b85f86dcd97b127 (patch) | |
tree | aa6dee0c0f479a4d192ce245efbedff49dc9d9bd /source/blender/blenkernel | |
parent | a99f6e5df18d4f8bf480bf69d439f86311794fc1 (diff) |
GPencil: Fix unreported memory leak
Thanks to @dfelinto for his help
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/gpencil_modifier.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index fe087256d25..bc0c54ed96e 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -862,6 +862,14 @@ void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob) const bool time_remap = BKE_gpencil_has_time_modifiers(ob); int cfra_eval = (int)DEG_get_ctime(depsgraph); + /* Clear any previous evaluated data. */ + if (ob->runtime.gpencil_tot_layers > 0) { + for (int i = 0; i < ob->runtime.gpencil_tot_layers; i++) { + bGPDframe *gpf_eval = &ob->runtime.gpencil_evaluated_frames[i]; + BKE_gpencil_free_frame_runtime_data(gpf_eval); + } + } + /* Create array of evaluated frames equal to number of layers. */ ob->runtime.gpencil_tot_layers = BLI_listbase_count(&gpd->layers); CLAMP_MIN(ob->runtime.gpencil_tot_layers, 1); |