[Bf-blender-cvs] [00abe6e] blender-v2.78-release: Fix/Workaround T49297: Crash related to custom data draw (Blender with ASAN)

Sergey Sharybin noreply at git.blender.org
Wed Sep 14 10:38:43 CEST 2016


Commit: 00abe6ecf178606aa78b281c11ab47eef6865fea
Author: Sergey Sharybin
Date:   Fri Sep 9 10:55:22 2016 +0200
Branches: blender-v2.78-release
https://developer.blender.org/rB00abe6ecf178606aa78b281c11ab47eef6865fea

Fix/Workaround T49297: Crash related to custom data draw (Blender with ASAN)

Root of the issue is that active render index became wrong. This is the actual
thing to be fixed, but as usual this is quite tricky to reproduce. Since such
bad situation might have happened more and fix isn't really difficult or
intruisive let's avoid crash for now.

Can be revisited once we figure out root of the issue.

Nice for 2.78 release.

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

M	source/blender/blenkernel/intern/DerivedMesh.c

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

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 5f759c6..8168817 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -3474,13 +3474,17 @@ void DM_calc_loop_tangents(
 
 		/* Update active layer index */
 		uv_index = CustomData_get_layer_index_n(&dm->loopData, CD_MLOOPUV, act_uv_n);
-		tan_index = CustomData_get_named_layer_index(&dm->loopData, CD_TANGENT, dm->loopData.layers[uv_index].name);
-		CustomData_set_layer_active_index(&dm->loopData, CD_TANGENT, tan_index);
+		if (uv_index != -1) {
+			tan_index = CustomData_get_named_layer_index(&dm->loopData, CD_TANGENT, dm->loopData.layers[uv_index].name);
+			CustomData_set_layer_active_index(&dm->loopData, CD_TANGENT, tan_index);
+		}
 
 		/* Update render layer index */
 		uv_index = CustomData_get_layer_index_n(&dm->loopData, CD_MLOOPUV, ren_uv_n);
-		tan_index = CustomData_get_named_layer_index(&dm->loopData, CD_TANGENT, dm->loopData.layers[uv_index].name);
-		CustomData_set_layer_render_index(&dm->loopData, CD_TANGENT, tan_index);
+		if (uv_index != -1) {
+			tan_index = CustomData_get_named_layer_index(&dm->loopData, CD_TANGENT, dm->loopData.layers[uv_index].name);
+			CustomData_set_layer_render_index(&dm->loopData, CD_TANGENT, tan_index);
+		}
 	}
 }




More information about the Bf-blender-cvs mailing list