Popups lead to crash if operator has 'UNDO' options not set and properties are manipulated #39974

Closed
opened 2014-04-30 20:30:41 +02:00 by CodeManX · 6 comments
Member

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')

**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') ```
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @CodeManX

Added subscriber: @CodeManX

This issue was referenced by blender/blender-addons-contrib@4b75956330

This issue was referenced by blender/blender-addons-contrib@4b759563300633e24f7aa12baa4417e42b8ed018

This issue was referenced by blender/blender@4b75956330

This issue was referenced by blender/blender@4b759563300633e24f7aa12baa4417e42b8ed018

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit blender/blender@4b75956330.

Closed by commit blender/blender@4b75956330.
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#39974
No description provided.