Page MenuHome

Node PointerProperty Double Free
Needs ReviewPublic

Authored by Adam Johnson (hoikas) on Jan 12 2019, 3:55 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This issue affects Blender 2.79b and is not fixed in the latest head of blender2.7. When using a bpy.types.PointerProperty with a type that is a Blender ID datablock in Python Nodes, a double-free error will occur any time the node's tree is freed, causing Blender to crash. This will happen any time an event occurs that triggers a blendfile reload. Off the top of my head, this occurs on opening a new blend and using the undo feature. A sample script illustrating the problem is attached below:

The solution I arrived at was to propagate the do_id_user argument to the various node free functions and ensure that the id properties were freed only by the node free method and not by the node tree free method. This seemed to match the approach used in the blender kernel from what I could ascertain. When Blender is compiled with the problem patch, the sample script does not crash blender.

Diff Detail

Repository
rB Blender