Fix T75574: Instant crash: averaging custom normals on model.

Fairly critical code mistake actually, since it uses malloca,
BLI_smallstack should *never* be declared inside a loop...

Also optimized handling of the `loop_weight` heapsimple, we can also
only create and use a single one for all edited objects...

Found two other operators potentially affected by same issue (split
normals, and weld edges into faces).
This commit is contained in:
2020-05-13 18:42:10 +02:00
parent c7f74863dd
commit 2b5e301ea4
2 changed files with 20 additions and 11 deletions

View File

@@ -704,6 +704,8 @@ static int edbm_face_split_by_edges_exec(bContext *C, wmOperator *UNUSED(op))
BMEdge *e;
BMIter iter;
BLI_SMALLSTACK_DECLARE(loop_stack, BMLoop *);
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(
@@ -717,8 +719,6 @@ static int edbm_face_split_by_edges_exec(bContext *C, wmOperator *UNUSED(op))
continue;
}
BLI_SMALLSTACK_DECLARE(loop_stack, BMLoop *);
{
BMVert *v;
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {