Fix T59338: Blender crashes immediately after loading attached file in ~80% of my attempts.

Issue was a concurrent modification of an evaluated mesh by two
other meshes using it as source for custom normals data transfer.

Note that this fixes the crash (modifiers are strictly forbidden to modify
any data besides their own!), but now will have to add a new CD type to
be able to specifically request 'computed' clnors data layer, and not
only 'encoded' one, for source mesh...
This commit is contained in:
Bastien Montagne 2019-02-20 16:59:04 +01:00
parent 8986c92b65
commit fab573bac0
Notes: blender-bot 2023-05-22 12:40:41 +02:00
Referenced by issue #59338, Blender crashes immediately after loading attached file in ~80% of my attempts
1 changed files with 5 additions and 3 deletions

View File

@ -249,7 +249,7 @@ int BKE_object_data_transfer_dttype_to_srcdst_index(const int dtdata_type)
static void data_transfer_dtdata_type_preprocess(
Mesh *me_src, Mesh *me_dst,
const int dtdata_type, const bool dirty_nors_dst)
const int dtdata_type, const bool dirty_nors_dst, const bool is_modifier)
{
if (dtdata_type == DT_TYPE_LNOR) {
/* Compute custom normals into regular loop normals, which will be used for the transfer. */
@ -267,7 +267,9 @@ static void data_transfer_dtdata_type_preprocess(
const bool use_split_nors_dst = (me_dst->flag & ME_AUTOSMOOTH) != 0;
const float split_angle_dst = me_dst->smoothresh;
BKE_mesh_calc_normals_split(me_src);
if (!is_modifier) {
BKE_mesh_calc_normals_split(me_src);
}
float (*poly_nors_dst)[3];
float (*loop_nors_dst)[3];
@ -1145,7 +1147,7 @@ bool BKE_object_data_transfer_ex(
continue;
}
data_transfer_dtdata_type_preprocess(me_src, me_dst, dtdata_type, dirty_nors_dst);
data_transfer_dtdata_type_preprocess(me_src, me_dst, dtdata_type, dirty_nors_dst, is_modifier);
cddata_type = BKE_object_data_transfer_dttype_to_cdtype(dtdata_type);