Page MenuHome

Popups lead to crash if operator has 'UNDO' options not set and properties are manipulated
Closed, ResolvedPublic

Description

System Information
Windows 7, 64bit

Blender Version
Broken: 2.70.4 (1e39046)

Short description of error
Operators which invoke popups and have no 'UNDO' in bl_options crash Blender when edits are made to the properties shown in the popup.

A runtime error is raised if no options are set at all during an invocation, so should a missing 'UNDO' throw an error if invoke_*popup() functions are called in invoke().

Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps

Test script:

import bpy


def main(context):
    for ob in context.scene.objects:
        print(ob)


class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"
    bl_options = {'REGISTER'} # no 'UNDO' !
    
    my_string = bpy.props.StringProperty("My String")

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def invoke(self, context, event):
        return context.window_manager.invoke_props_popup(self, event)

    def execute(self, context):
        main(context)
        return {'FINISHED'}


def register():
    bpy.utils.register_class(SimpleOperator)


def unregister():
    bpy.utils.unregister_class(SimpleOperator)


if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.simple_operator('INVOKE_DEFAULT')

Event Timeline

codemanx created this task.Apr 30 2014, 8:30 PM
codemanx raised the priority of this task from to 90.
codemanx updated the task description. (Show Details)
codemanx edited a custom field.
codemanx added a subscriber: codemanx.
Campbell Barton (campbellbarton) changed the task status from Unknown Status to Resolved.Apr 30 2014, 9:29 PM

Closed by commit rB4b7595633006.