Segmentation fault after pasting a closed group of nodes into an open group
Closed, ResolvedPublic


Easy to reproduce:

- open blender
- set the rendering engine to Cycles Render
- select an object (eg. the default cube)
- clic on Material icon in Properties
- clic Use Nodes
- go to Node Editor (change the current view or add a new one... whatever)

- create a node (eg. Noise Texture : Add > Texture > Noise Texture)
- (you can add some other nodes but it has no influence)
- select it (or them)
- create a new group : CTRL+G
- close the group : TAB
- copy the group : CTRL+C
- open the group : TAB
- past the copied group : CTRL+V

Blender crash : Segmentation fault (core dumped)

CPU: Intel(R) Core(TM)2 Quad CPU Q9300 @ 2.50GHz x 4
RAM: 4096MB
GFX: nVidia GeForce 9600 GT (G94, rev a1)
OS: Ubuntu 12.04 (precise) 64-bit, Kernel Linux 3.2.0-35-generic
Drivers: NVIDIA accelerated graphics drivers
Blender: 2.65.0 r52859



This operation should not be allowed, pasting a group into itself will give an infinite loop. Lukas, do we have a check for this?

Yeah, i was afraid somebody would try stuff like this sooner or later :S

Problem with preventing this case ("reentrant" node group, infinite recursion) is that we don't really have any kind of general system to check the validity of nodes in a specific context. All the checks that are done (e.g. group inside group, render layer only in base trees) are hacks on the operator level.

In the customnodes branch (aka "pynodes") i implemented a two-stage polling system for this purpose:
1) "poll" classmethod: checks if a node instance of type X can be created in a given tree. Is a class method to allow checking before actually creating a node instance, e.g. in the API function.
2) "poll_instance": checks if a specific node instance can be *inserted* into a given tree. This may depend on the node's settings, in case of node groups this would check if the linked group tree is a parent of the tree it's inserted into (or the tree itself), to prevent recursion.

The system is not quite perfect, since an operator may want to create a node and then change settings, only to find out these settings are invalid (point in case: desired node group tree can not be used). But a generic poll system of some kind would be the way to go.

For now i can try to add a quick hack to the clipboard paste operator to prevent this case.

Just a try to avoïd the recursion: why not create a *copy* of the node instead of pasting the original one ?

It is making a copy of the node, but that node is still using the same node group, which is what it should be doing. Groups are nodes are meant to share their contents unless the group is explicitly duplicated by the user.

Lukas, I suggest just adding a quick check for this in the tool, or leave it as todo as part of pynodes merge.

If this will be fixed with the pyNodes merge, I guess we can close this here now and mark as todo for the remaining days? ;)

Still crashes with latest SVN, Lukas can you please check?

Your reported issue has been fixed in SVN. Thanks for taking the
time to report!.

Lukas Toenne (lukastoenne) closed this task as "Resolved".Apr 3 2013, 11:11 AM

Add Comment