Skip to content

Container Modifications and Potential Invalidation of Handles #184

@Vollkornaffe

Description

@Vollkornaffe

This could be a bug.

Is NodeToPython careful concerning handle invalidation on container modifications?

In the generated code, there appears to be a pattern of generating first:

node_a = node_tree.nodes.new("some node")
node_b = node_tree.nodes.new("some node")
node_c = node_tree.nodes.new("some node")

And using the returned handles later:

node_tree.links.new(
    node_a.outputs[0], node_b.inputs[0]
)

This might be fine if the underlying container, in this case, the nodes of the tree, doesn't reallocate?
But it might also cause undefined behavior and/or cause Blender to crash.

See also https://docs.blender.org/api/current/info_gotchas_crashes.html

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions