Alembic procedural: fix crash when cancelling a render during

synchronization
This commit is contained in:
Kévin Dietrich 2021-02-03 06:43:38 +01:00
parent 9734a78bc8
commit 55c88e5582
1 changed files with 14 additions and 2 deletions

View File

@ -1317,12 +1317,24 @@ AlembicProcedural::~AlembicProcedural()
foreach (Node *node, objects) {
AlembicObject *abc_object = static_cast<AlembicObject *>(node);
objects_set.insert(abc_object->get_object());
geometries_set.insert(abc_object->get_object()->get_geometry());
if (abc_object->get_object()) {
objects_set.insert(abc_object->get_object());
if (abc_object->get_object()->get_geometry()) {
geometries_set.insert(abc_object->get_object()->get_geometry());
}
}
delete_node(abc_object);
}
/* We may delete a Procedural before rendering started, so scene_ can be null. */
if (!scene_) {
assert(geometries_set.empty());
assert(objects_set.empty());
return;
}
scene_->delete_nodes(geometries_set, this);
scene_->delete_nodes(objects_set, this);
}