[Bf-blender-cvs] [70a3b7e70ce] blender2.8: Fix T55170 and T55167: Crash adding new curve

Germano noreply at git.blender.org
Thu May 24 10:38:47 CEST 2018


Commit: 70a3b7e70ce145266b37d90f31d3f8e3faf50717
Author: Germano
Date:   Thu May 24 10:34:24 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB70a3b7e70ce145266b37d90f31d3f8e3faf50717

Fix T55170 and T55167: Crash adding new curve

We do the same solution as we have for mesh_evaluated.

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

M	source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc

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

diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index c8b9702621e..17ca1733d42 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -49,6 +49,7 @@
 #include "BLI_threads.h"
 #include "BLI_string.h"
 
+#include "BKE_curve.h"
 #include "BKE_global.h"
 #include "BKE_idprop.h"
 #include "BKE_layer.h"
@@ -680,6 +681,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
 	ListBase gpumaterial_backup;
 	ListBase *gpumaterial_ptr = NULL;
 	Mesh *mesh_evaluated = NULL;
+	CurveCache *curve_cache = NULL;
 	short base_flag = 0;
 	if (check_datablock_expanded(id_cow)) {
 		switch (id_type) {
@@ -729,6 +731,10 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
 						object->data = mesh_evaluated->id.orig_id;
 					}
 				}
+				/* Store curve cache and make sure we don't free it. */
+				curve_cache = object->curve_cache;
+				object->curve_cache = NULL;
+
 				/* Make a backup of base flags. */
 				base_flag = object->base_flag;
 				break;
@@ -764,6 +770,9 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
 				        ((Mesh *)mesh_evaluated->id.orig_id)->edit_btmesh;
 			}
 		}
+		if (curve_cache != NULL) {
+			object->curve_cache = curve_cache;
+		}
 		object->base_flag = base_flag;
 	}
 	return id_cow;



More information about the Bf-blender-cvs mailing list