The issue was that the transform code kept non-const pointers into the
position arrays of `CurvesGeometry` for an extended period if time and
changed the positions through those pointers. This is not safe, because
the underlying position array may become shared (e.g. with the
corresponding evaluated object), in which case it's not allowed to change
the position array anymore without making a copy.
Generally, the scope at which some code has multiple access to data
should be as small as possible to avoid this kind of issue.
The solution is to store the positions that are modified by the transform
code in a new array and to copy those back into the `CurvesGeometry`
in one go. This way, the program scope in which the positions may be
modified is more obvious and much smaller.
Pull Request: https://projects.blender.org/blender/blender/pulls/120824