Fix #135101: Grease Pencil: Eraser crashes when handling multiple layers
Changing the `affected_drawings_` set in a threaded loop is not safe. Since running the eraser in parallel over multiple drawings is unlikely to improve performance on top of internal threading, handling layers in a simple sequential loop is preferable here. Pull Request: https://projects.blender.org/blender/blender/pulls/135428
This commit is contained in:
@@ -1023,10 +1023,9 @@ struct EraseOperationExecutor {
|
||||
/* Erase on all editable drawings. */
|
||||
const Vector<ed::greasepencil::MutableDrawingInfo> drawings =
|
||||
ed::greasepencil::retrieve_editable_drawings(*scene, grease_pencil);
|
||||
threading::parallel_for_each(
|
||||
drawings, [&](const ed::greasepencil::MutableDrawingInfo &info) {
|
||||
execute_eraser_on_drawing(info.layer_index, info.frame_number, info.drawing);
|
||||
});
|
||||
for (const ed::greasepencil::MutableDrawingInfo &info : drawings) {
|
||||
execute_eraser_on_drawing(info.layer_index, info.frame_number, info.drawing);
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
|
||||
Reference in New Issue
Block a user