Page MenuHome

collection.objects.link() UNDO crash
Closed, DuplicatePublicBUG

Description

System Information
Operating system: Linux-5.7.10-201.fc32.x86_64-x86_64-with-fedora-32-Thirty_Two 64 Bits
Graphics card: GeForce GTX 970M/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.100

Blender Version
Broken: version: 2.91.0 Alpha, branch: master, commit date: 2020-08-17 02:40, hash: rB0b4a365183c3
Broken: 2.83.0
Worked: 2.82a

running this operator on the default cube and then using UNDO will crash Blender 2.83.0

import bpy

class SimpleOperatorbug(bpy.types.Operator):
    bl_idname = "object.simple_operatorbug"
    bl_label = "simple operator bug"

    def execute(self, context):
        new_mesh1 = bpy.data.meshes.new("xx")
        new_object1 = bpy.data.objects.new("xx2", new_mesh1)
        bpy.data.collections["Collection"].objects.link(new_object1)
        return {'FINISHED'}

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

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

if __name__ == "__main__":
    register()