Crash: Python Operator Create New Object Then Undo #81346

Closed
opened 2020-10-01 09:39:56 +02:00 by Wayde Moss · 5 comments
Member

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 441.66

Blender Version
Broken: version: 2.90.0, branch: master, commit date: 2020-08-31 11:26, hash: 0330d1af29
2.83.4
2.83.0
2.91 (build from September 29, 2020)

Worked: (newest version of Blender that worked as expected)
2.82.7
2.81.16

Short description of error
Undoing an operator that creates an object and links it to a collection will crash Blender. Oddly enough, doing the same thing but outside an operator will not crash Blender on undo. The video shows both cases.

Exact steps for others to reproduce the error
The provided file will open with the proper UI.
Run script
In View3D, open "Crash" Tab (N) and press "Simple Object Operator" button.
Undo (crashes)

undo_new_object_from_operator.blend
Crash:
crash.mp4
Similar But No Crash:
similar_but_no_crash.mp4

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 441.66 **Blender Version** Broken: version: 2.90.0, branch: master, commit date: 2020-08-31 11:26, hash: `0330d1af29` 2.83.4 2.83.0 2.91 (build from September 29, 2020) Worked: (newest version of Blender that worked as expected) 2.82.7 2.81.16 **Short description of error** Undoing an operator that creates an object and links it to a collection will crash Blender. Oddly enough, doing the same thing but outside an operator will not crash Blender on undo. The video shows both cases. **Exact steps for others to reproduce the error** The provided file will open with the proper UI. Run script In View3D, open "Crash" Tab (N) and press "Simple Object Operator" button. Undo (crashes) [undo_new_object_from_operator.blend](https://archive.blender.org/developer/F8943097/undo_new_object_from_operator.blend) Crash: [crash.mp4](https://archive.blender.org/developer/F8943136/crash.mp4) Similar But No Crash: [similar_but_no_crash.mp4](https://archive.blender.org/developer/F8943135/similar_but_no_crash.mp4)
Author
Member

Added subscriber: @wbmoss_dev

Added subscriber: @wbmoss_dev
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Looks like #77557 (Python Operators that add/remove ID data without an undo step crash Blender)

Since the new Undo system in 2.83, you have to add an Undo push to operators that add or remove ID data

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"
    bl_options = {'UNDO'}

Doing this will prevent the crash

Or: use the Undo Legacy option in User Preferences > Experimental > Debugging

So, this is a known thing (will merge this report into #77557), but you have a workaround to fix this already (add the UNDO option to your operator).

Looks like #77557 (Python Operators that add/remove ID data without an undo step crash Blender) Since the new Undo system in 2.83, you have to add an Undo push to operators that add or remove ID data ``` class SimpleOperator(bpy.types.Operator): """Tooltip""" bl_idname = "object.simple_operator" bl_label = "Simple Object Operator" bl_options = {'UNDO'} ``` Doing this will prevent the crash Or: use the `Undo Legacy` option in `User Preferences` > `Experimental` > `Debugging` So, this is a known thing (will merge this report into #77557), but you have a workaround to fix this already (add the UNDO option to your operator).
Member

Closed as duplicate of #77557

Closed as duplicate of #77557
Author
Member

Thanks, the workarounds (manually pushing undo) in the other report works for my actual use case.

Thanks, the workarounds (manually pushing undo) in the other report works for my actual use case.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 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#81346
No description provided.