Fix #126624: Sculpt undo crash with shape keys

Caused by 18a7aff3e2
`search_gather()` returns vector but span is used to receive list from
function call. This results in crash due to accessing invalid data.

Pull Request: https://projects.blender.org/blender/blender/pulls/126626
This commit is contained in:
Pratik Borhade
2024-08-22 15:03:10 +02:00
committed by Hans Goudey
parent 03ae57dd8b
commit 3a1f71c06e

View File

@@ -856,7 +856,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
break;
}
case Type::Position: {
const Span<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
BKE_sculpt_update_object_for_edit(depsgraph, &object, false);
if (!topology_matches(step_data, object)) {
@@ -903,7 +903,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
break;
}
case Type::HideVert: {
const Span<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
BKE_sculpt_update_object_for_edit(depsgraph, &object, false);
if (!topology_matches(step_data, object)) {
@@ -942,7 +942,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
break;
}
case Type::HideFace: {
const Span<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
BKE_sculpt_update_object_for_edit(depsgraph, &object, false);
if (!topology_matches(step_data, object)) {
@@ -983,7 +983,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
break;
}
case Type::Mask: {
const Span<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
BKE_sculpt_update_object_for_edit(depsgraph, &object, false);
if (!topology_matches(step_data, object)) {
@@ -1017,7 +1017,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
break;
}
case Type::FaceSet: {
const Span<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
BKE_sculpt_update_object_for_edit(depsgraph, &object, false);
if (!topology_matches(step_data, object)) {
@@ -1054,7 +1054,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
break;
}
case Type::Color: {
const Span<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
const Vector<bke::pbvh::Node *> nodes = bke::pbvh::search_gather(*ss.pbvh, {});
BKE_sculpt_update_object_for_edit(depsgraph, &object, false);
if (!topology_matches(step_data, object)) {