Fix T52814 and T58686: Alembic crashing on fluid sim export

The velocities std::vector was allocated in too narrow a scope, causing
use-after-free errors.
This commit is contained in:
Sybren A. Stüvel
2019-07-09 16:22:52 +02:00
parent 6510ab8676
commit 817e2796cb

View File

@@ -409,6 +409,7 @@ void AbcGenericMeshWriter::writeMesh(struct Mesh *mesh)
{
std::vector<Imath::V3f> points, normals;
std::vector<int32_t> poly_verts, loop_counts;
std::vector<Imath::V3f> velocities;
bool smooth_normal = false;
@@ -458,9 +459,7 @@ void AbcGenericMeshWriter::writeMesh(struct Mesh *mesh)
}
if (m_is_liquid) {
std::vector<Imath::V3f> velocities;
getVelocities(mesh, velocities);
m_mesh_sample.setVelocities(V3fArraySample(velocities));
}