diff options
author | Jacques Lucke <jacques@blender.org> | 2020-09-16 11:38:51 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-09-16 11:39:04 +0300 |
commit | ba85b4e45cbb91d908478975071356fe44a7711b (patch) | |
tree | b9f48e05e90419a6353b81314ff9109389247bcb /source | |
parent | cee6518b5e908ae25495f5d4e9778b1911ce2d19 (diff) |
Fix: create shallow copy of CustomData before writing
CustomData_blend_write_prepare might modify the `CustomData`
instance, making it invalid afterwards. It is not necessary to do this
in other cases explicitly, because when writing shallow copies of
ID data blocks are made.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/simulation.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/simulation.cc b/source/blender/blenkernel/intern/simulation.cc index f08051510db..eacb854950d 100644 --- a/source/blender/blenkernel/intern/simulation.cc +++ b/source/blender/blenkernel/intern/simulation.cc @@ -172,13 +172,14 @@ static void simulation_blend_write(BlendWriter *writer, ID *id, const void *id_a ParticleSimulationState *particle_state = (ParticleSimulationState *)state; CustomDataLayer *players = NULL, players_buff[CD_TEMP_CHUNK_SIZE]; + CustomData attributes_shallow_copy = particle_state->attributes; CustomData_blend_write_prepare( - &particle_state->attributes, &players, players_buff, ARRAY_SIZE(players_buff)); + &attributes_shallow_copy, &players, players_buff, ARRAY_SIZE(players_buff)); BLO_write_struct(writer, ParticleSimulationState, particle_state); CustomData_blend_write(writer, - &particle_state->attributes, + &attributes_shallow_copy, players, particle_state->tot_particles, CD_MASK_ALL, |