Fix: Crash opening new file after having one open with Subsirf

There is some special code in the Object's freeing which did
special checks for SubdivCCG based on the evaluated mesh state.
If the depsgraph is destroyed prior to the evaluated object it
makes object to access freed components of ID node.

The fix makes it so the evaluated ID is freed prior to freeing
components.
This commit is contained in:
Sergey Sharybin 2024-06-20 17:02:55 +02:00
parent 5a8003091c
commit bab46b4f02

View file

@ -116,10 +116,6 @@ void IDNode::destroy()
return;
}
for (ComponentNode *comp_node : components.values()) {
delete comp_node;
}
/* Free memory used by this evaluated ID. */
if (!ELEM(id_cow, id_orig, nullptr)) {
deg_free_eval_copy_datablock(id_cow);
@ -129,6 +125,10 @@ void IDNode::destroy()
"Destroy evaluated ID for %s: id_orig=%p id_cow=%p\n", id_orig->name, id_orig, id_cow);
}
for (ComponentNode *comp_node : components.values()) {
delete comp_node;
}
/* Tag that the node is freed. */
id_orig = nullptr;
}