Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-07-12 17:26:50 +0300
committerJacques Lucke <jacques@blender.org>2022-07-12 17:27:06 +0300
commitd58072caf4abb254d5e5f0e3b9de9bef775f287a (patch)
tree13a60046e31c007f1d889382620ca27e09eb7ce8
parent47dd42485e19106601167f6be7b5960c4be25167 (diff)
Fix: missing geometry copy before modifying it
A geometry component may reference read-only geometry. In this case it has to be copied before making changes to it. This was caused by rBb876ce2a4a4638142.
-rw-r--r--source/blender/blenkernel/intern/geometry_component_curve.cc3
-rw-r--r--source/blender/blenkernel/intern/geometry_component_curves.cc3
-rw-r--r--source/blender/blenkernel/intern/geometry_component_mesh.cc3
-rw-r--r--source/blender/blenkernel/intern/geometry_component_pointcloud.cc3
4 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/geometry_component_curve.cc b/source/blender/blenkernel/intern/geometry_component_curve.cc
index 0d899ec7b06..22f105af0f1 100644
--- a/source/blender/blenkernel/intern/geometry_component_curve.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curve.cc
@@ -1452,7 +1452,8 @@ std::optional<blender::bke::AttributeAccessor> CurveComponentLegacy::attributes(
std::optional<blender::bke::MutableAttributeAccessor> CurveComponentLegacy::attributes_for_write()
{
- return blender::bke::MutableAttributeAccessor(curve_,
+ CurveEval *curve = this->get_for_write();
+ return blender::bke::MutableAttributeAccessor(curve,
blender::bke::get_curve_accessor_functions_ref());
}
diff --git a/source/blender/blenkernel/intern/geometry_component_curves.cc b/source/blender/blenkernel/intern/geometry_component_curves.cc
index 34c17bedc2c..f803b08e740 100644
--- a/source/blender/blenkernel/intern/geometry_component_curves.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curves.cc
@@ -644,6 +644,7 @@ std::optional<blender::bke::AttributeAccessor> CurveComponent::attributes() cons
std::optional<blender::bke::MutableAttributeAccessor> CurveComponent::attributes_for_write()
{
- return blender::bke::MutableAttributeAccessor(curves_ ? &curves_->geometry : nullptr,
+ Curves *curves = this->get_for_write();
+ return blender::bke::MutableAttributeAccessor(curves ? &curves->geometry : nullptr,
blender::bke::get_curves_accessor_functions_ref());
}
diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc
index cb36b9b19f7..cf6681a69be 100644
--- a/source/blender/blenkernel/intern/geometry_component_mesh.cc
+++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc
@@ -1324,7 +1324,8 @@ std::optional<blender::bke::AttributeAccessor> MeshComponent::attributes() const
std::optional<blender::bke::MutableAttributeAccessor> MeshComponent::attributes_for_write()
{
- return blender::bke::MutableAttributeAccessor(mesh_,
+ Mesh *mesh = this->get_for_write();
+ return blender::bke::MutableAttributeAccessor(mesh,
blender::bke::get_mesh_accessor_functions_ref());
}
diff --git a/source/blender/blenkernel/intern/geometry_component_pointcloud.cc b/source/blender/blenkernel/intern/geometry_component_pointcloud.cc
index b439a9ba7f8..ccc97f92dbc 100644
--- a/source/blender/blenkernel/intern/geometry_component_pointcloud.cc
+++ b/source/blender/blenkernel/intern/geometry_component_pointcloud.cc
@@ -226,8 +226,9 @@ std::optional<blender::bke::AttributeAccessor> PointCloudComponent::attributes()
std::optional<blender::bke::MutableAttributeAccessor> PointCloudComponent::attributes_for_write()
{
+ PointCloud *pointcloud = this->get_for_write();
return blender::bke::MutableAttributeAccessor(
- pointcloud_, blender::bke::get_pointcloud_accessor_functions_ref());
+ pointcloud, blender::bke::get_pointcloud_accessor_functions_ref());
}
/** \} */