Commit: dcefce5eae9bdcc2b0fdcbc371fcf17e0ef0ada0
Author: Joshua Leung
Date:   Thu Aug 23 16:02:09 2018 +1200
Branches: blender2.8
https://developer.blender.org/rBdcefce5eae9bdcc2b0fdcbc371fcf17e0ef0ada0

Fix memory leak - the temporary depsgraph instance was not getting freed after 
use

===================================================================

M       source/blender/editors/armature/pose_edit.c

===================================================================

diff --git a/source/blender/editors/armature/pose_edit.c 
b/source/blender/editors/armature/pose_edit.c
index 3586a219fd8..2445a3dc062 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -198,6 +198,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, 
Object *ob)
        struct Main *bmain = CTX_data_main(C);
        Depsgraph *depsgraph = CTX_data_depsgraph(C);
        ListBase targets = {NULL, NULL};
+       bool free_depsgraph = false;
 
        /* Override depsgraph with a filtered, simpler copy */
        if (G.debug_value == 555) {
@@ -210,6 +211,7 @@ TIMEIT_START(filter_pose_depsgraph);
                BLI_addtail(&query.targets, dft_ob);
                
                depsgraph = DEG_graph_filter(depsgraph, bmain, &query);
+               free_depsgraph = true;
                
                MEM_freeN(dft_ob);
 TIMEIT_END(filter_pose_depsgraph);
@@ -233,6 +235,11 @@ TIMEIT_END(pose_path_calc);
 
        /* tag armature object for copy on write - so paths will draw/redraw */
        DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE);
+       
+       /* Free temporary depsgraph instance */
+       if (free_depsgraph) {
+               DEG_graph_free(depsgraph);
+       }
 }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to