[Bf-blender-cvs] [dcefce5eae9] blender2.8: Fix memory leak - the temporary depsgraph instance was not getting freed after use

Joshua Leung noreply at git.blender.org
Thu Aug 23 07:11:24 CEST 2018


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);
+	}
 }



More information about the Bf-blender-cvs mailing list