diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-04-21 17:51:51 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-04-21 17:51:51 +0400 |
commit | d3d41df6ee41748ad037100b5070d482ad6af45f (patch) | |
tree | 9f8331e8515ac156276c929f76bd0ad2f8dd9347 /release | |
parent | d404f7fbe4b39d8bf52b0cc3b4d838e6e40c9e70 (diff) |
Fix for add nodes search box showing nasty "UUUUUUUU"-like entries with some python builds...
Workaround for an issue with python: strings generated by py scripts should also exist in python as long as they are used in C. Else C code may access freed memory.
Simply store the generated list of items in the class, for now. :/
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/node.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py index 4878b1c45ae..c8049189b5b 100644 --- a/release/scripts/startup/bl_operators/node.py +++ b/release/scripts/startup/bl_operators/node.py @@ -168,7 +168,10 @@ def node_items_iter(context): # Create an enum list from node class items def node_type_items_cb(self, context): - return [(str(index), item[1], item[2]) for index, item in enumerate(node_items_iter(context))] + # XXX Python has to keep a ref to those strings, else they may be freed :( + NODE_OT_add_search._enum_str_store = [(str(index), item[1], item[2]) + for index, item in enumerate(node_items_iter(context))] + return NODE_OT_add_search._enum_str_store class NODE_OT_add_search(NodeAddOperator, Operator): @@ -177,6 +180,9 @@ class NODE_OT_add_search(NodeAddOperator, Operator): bl_label = "Search and Add Node" bl_options = {'REGISTER', 'UNDO'} + # XXX Python has to keep a ref to the data (strings) generated by enum's callback, else they may be freed :( + _enum_str_store = [] + # XXX this should be called 'node_type' but the operator search # property is hardcoded to 'type' by a hack in bpy_operator_wrap.c ... type = EnumProperty( |