Fix T38354: Excess memory allocation when projecting onto object with multires
Found three cases where created bvhtree was not freed...
This commit is contained in:
parent
12109dd18e
commit
afb9393dda
Notes:
blender-bot
2023-02-14 11:18:00 +01:00
Referenced by issue #38354, Excess memory allocation when projecting onto object with multires
|
@ -1570,6 +1570,7 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes
|
|||
retval |= 1;
|
||||
}
|
||||
}
|
||||
free_bvhtree_from_mesh(&treeData);
|
||||
break;
|
||||
}
|
||||
case SCE_SNAP_MODE_VERTEX:
|
||||
|
|
|
@ -309,6 +309,7 @@ static void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start
|
|||
copy_v3_v3(r_location, hit.co);
|
||||
copy_v3_v3(r_normal, hit.no);
|
||||
*index = dm_tessface_to_poly_index(ob->derivedFinal, hit.index);
|
||||
free_bvhtree_from_mesh(&treeData);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -317,6 +318,7 @@ static void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start
|
|||
zero_v3(r_location);
|
||||
zero_v3(r_normal);
|
||||
*index = -1;
|
||||
free_bvhtree_from_mesh(&treeData);
|
||||
}
|
||||
|
||||
static void rna_Object_closest_point_on_mesh(Object *ob, ReportList *reports, float point_co[3], float max_dist,
|
||||
|
@ -348,6 +350,7 @@ static void rna_Object_closest_point_on_mesh(Object *ob, ReportList *reports, fl
|
|||
copy_v3_v3(n_location, nearest.co);
|
||||
copy_v3_v3(n_normal, nearest.no);
|
||||
*index = dm_tessface_to_poly_index(ob->derivedFinal, nearest.index);
|
||||
free_bvhtree_from_mesh(&treeData);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -355,6 +358,7 @@ static void rna_Object_closest_point_on_mesh(Object *ob, ReportList *reports, fl
|
|||
zero_v3(n_location);
|
||||
zero_v3(n_normal);
|
||||
*index = -1;
|
||||
free_bvhtree_from_mesh(&treeData);
|
||||
}
|
||||
|
||||
/* ObjectBase */
|
||||
|
|
Loading…
Reference in New Issue