EnumProperty with ENUM_FLAG and item callback crashes on click
Closed, ResolvedPublic

Description

System Information
Windows 7, 64bit

Blender Version
Broken: 6852184 (2014-02-03, master modified)
Worked: 2.69 official (at least no crash)

Short description of error
A dynamically populated EnumProperty (items <- func) with ENUM_FLAG for multi-select crashes on click. No crash in 2.69 but:
Memoryblock free: pointer not in memlist

Exact steps for others to reproduce the error
Run attached script in 2.69 official, and see Object tab panel at the bottom. Select an object type and see how the second dropdown reacts (may clear label on change, although the property value doesn't change??)

Run it with a recent build, click on it and see it crashing.

The second property is not related to the crash. No crash with static enum items.

Details

Type
Bug
codemanx created this task.Feb 4 2014, 7:55 PM
codemanx updated the task description. (Show Details)
codemanx raised the priority of this task from to Needs Triage.
codemanx added projects: BF Blender, Python.
codemanx set Type to Bug.
codemanx added a subscriber: codemanx.

Fixed the incorrect memfree, however the script still crashes, this is a known problem with dynamic defined items.

A workaround is to store the return value from items_prop1 somewhere. eg:

def items_prop1(self, context):
    types = {ob.type: ob.type for ob in context.scene.objects}
    items_prop1.ret = [(t, t, "") for t in types]
    return items_prop1.ret