Fix T94534: dangling pointer in internal link after removing socket

The dangling pointer caused errors further down the line.
The solution is to simply delete an internal link when one
of the corresponding sockets is removed (just like normal
links are removed as well).
This commit is contained in:
Jacques Lucke 2022-01-08 17:36:43 +01:00
parent 937aa8e114
commit d5e73fa13d
Notes: blender-bot 2023-02-14 01:07:44 +01:00
Referenced by commit 9216cf9cb5, Fix: dangling internal links after removing sockets
Referenced by issue #94534, Geometry nodes. Deleting one free input crashes blender (only this file)
1 changed files with 8 additions and 0 deletions

View File

@ -1947,6 +1947,14 @@ void nodeRemoveSocketEx(struct bNodeTree *ntree,
}
}
LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &node->internal_links) {
if (link->fromsock == sock || link->tosock == sock) {
BLI_remlink(&node->internal_links, link);
MEM_freeN(link);
BKE_ntree_update_tag_node_internal_link(ntree, node);
}
}
/* this is fast, this way we don't need an in_out argument */
BLI_remlink(&node->inputs, sock);
BLI_remlink(&node->outputs, sock);