Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-03-15 17:41:41 +0300
committerJacques Lucke <jacques@blender.org>2021-03-15 17:41:41 +0300
commitcf5cada6b23d5b3670c1d321b2a566c5571941c0 (patch)
tree7c08a077ad5884d056f3d6f3988051196a0cb14c
parent3618948df85f18f6ab5d33e10139520b4c3dd092 (diff)
Nodes: fix crash after undo after recent multi-input-socket changes
The issue is that the `last_node_hovered_while_dragging_a_link` pointer is invalidated on undo. The pointer does not have to be on the space runtime data, because it only needs to exist as long as the operator is running. Differential Revision: https://developer.blender.org/D10726
-rw-r--r--source/blender/editors/space_node/node_intern.h3
-rw-r--r--source/blender/editors/space_node/node_relationships.c6
2 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 241cbee00f0..bf27ab18bd4 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -60,6 +60,8 @@ typedef struct bNodeLinkDrag {
/** Temporarily stores the last picked link from multi input socket operator. */
struct bNodeLink *last_picked_multi_input_socket_link;
+
+ struct bNode *last_node_hovered_while_dragging_a_link;
} bNodeLinkDrag;
typedef struct SpaceNode_Runtime {
@@ -77,7 +79,6 @@ typedef struct SpaceNode_Runtime {
/* XXX hack for translate_attach op-macros to pass data from transform op to insert_offset op */
/** Temporary data for node insert offset (in UI called Auto-offset). */
struct NodeInsertOfsData *iofsd;
- struct bNode *last_node_hovered_while_dragging_a_link;
} SpaceNode_Runtime;
/* space_node.c */
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 9293494a16a..ee07ec7a55c 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -902,7 +902,7 @@ static void node_link_find_socket(bContext *C, wmOperator *op, float cursor[2])
/* attach links to the socket */
link->tonode = tnode;
link->tosock = tsock;
- snode->runtime->last_node_hovered_while_dragging_a_link = tnode;
+ nldrag->last_node_hovered_while_dragging_a_link = tnode;
if (existing_link_connected_to_fromsock) {
link->multi_input_socket_index =
existing_link_connected_to_fromsock->multi_input_socket_index;
@@ -914,9 +914,9 @@ static void node_link_find_socket(bContext *C, wmOperator *op, float cursor[2])
else {
LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) {
bNodeLink *link = linkdata->data;
- if (snode->runtime->last_node_hovered_while_dragging_a_link) {
+ if (nldrag->last_node_hovered_while_dragging_a_link) {
sort_multi_input_socket_links(
- snode, snode->runtime->last_node_hovered_while_dragging_a_link, NULL, cursor);
+ snode, nldrag->last_node_hovered_while_dragging_a_link, NULL, cursor);
}
link->tonode = NULL;
link->tosock = NULL;