[Bf-blender-cvs] Git Commit [53fffba] master: Fix for own mistake in r61178: bNodeTree->links ListBase was being modified while iterating ...

noreply@git.blender.org (Lukas Tönne) at git.blender.org noreply@git.blender.org (Lukas Tönne) at git.blender.org
Fri Nov 15 17:06:39 CET 2013


Commit: 53fffbafbef694a2378fbf605cc25259a3154f37
Author: Lukas Tönne
Date:   Fri Nov 15 16:54:05 2013 +0100
http://developer.blender.org/rB53fffbafbef694a2378fbf605cc25259a3154f37

Fix for own mistake in r61178: bNodeTree->links ListBase was being modified while iterating ...

===================================================================

M	source/blender/editors/space_node/node_relationships.c

===================================================================

diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 9f5e8a6..b500665 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -401,22 +401,27 @@ static void node_remove_extra_links(SpaceNode *snode, bNodeLink *link)
 	bNodeSocket *from = link->fromsock, *to = link->tosock;
 	int max_from = from->limit, max_to = to->limit;
 	int count_from = 1, count_to = 1; /* start at 1, link is included */
-	bNodeLink *tlink;
+	bNodeLink *tlink, *tlink_next;
 	
-	for (tlink = ntree->links.first; tlink; tlink = tlink->next) {
+	for (tlink = ntree->links.first; tlink; tlink = tlink_next) {
+		tlink_next = tlink->next;
 		if (tlink == link)
 			continue;
 		
-		if (tlink->fromsock == from) {
+		if (tlink && tlink->fromsock == from) {
 			++count_from;
-			if (count_from > max_from)
+			if (count_from > max_from) {
 				nodeRemLink(ntree, tlink);
+				tlink = NULL;
+			}
 		}
 		
-		if (tlink->tosock == to) {
+		if (tlink && tlink->tosock == to) {
 			++count_to;
-			if (count_to > max_to)
+			if (count_to > max_to) {
 				nodeRemLink(ntree, tlink);
+				tlink = NULL;
+			}
 		}
 	}
 }




More information about the Bf-blender-cvs mailing list