Fix: dangling pointer caused use-after-free

The old code only worked when built-in nodes are only unregistered
at most once while Blender is running. However, this is not the case
when running certain unit tests such as `AbstractHierarchy*`
in `blender_test`.

Found by Sybren, thanks.
This commit is contained in:
Jacques Lucke 2021-10-18 16:17:56 +02:00
parent ef7e21fd4a
commit dd689eeda4
1 changed files with 1 additions and 0 deletions

View File

@ -1380,6 +1380,7 @@ static void node_free_type(void *nodetype_v)
}
delete nodetype->fixed_declaration;
nodetype->fixed_declaration = nullptr;
/* Can be null when the type is not dynamically allocated. */
if (nodetype->free_self) {