Adding/removing items to CollectionProperty in PropertyGroup and UNDO I've added PropertyGroup with CollectionProperty of custom type and define operator for adding/removing items to this property. And User list (bpy.types.UIList) to check changes in this CollectionProperty.

Everything works fine, but undo functionality work with this operator, except changes for adding/removing CollectionProperty items. I wonder is this bug, or i should check my code?

Partial code for PropertyGroup(is this to complex data for UNDO?):

class FaceGroupsPropGroup(bpy.types.PropertyGroup):
    reg_index = 2

    @classmethod
    def register(self):
        bpy.types.Mesh.face_groups = bpy.props.CollectionProperty(
            name="Face groups",
            description="Face groups",
            type=self,
        )
        self.fusion_mstates = bpy.props.CollectionProperty(type=FusionStates)


        bpy.types.Mesh.fgroup_active_index = bpy.props.IntProperty(name="Active index",
                                                                   default=0,
                                                                   update=self.index_update)

        bpy.types.Scene.fgroups_live = bpy.props.BoolProperty(default=False)
        bpy.types.Scene.fg_smooth_iterations = bpy.props.IntProperty(min=0)
        bpy.types.Scene.fg_fatten = bpy.props.FloatProperty()
        self.name = bpy.props.StringProperty(name="Name", default="Group")
        self.wm = bpy.props.FloatVectorProperty(name="World matrix", size=16, subtype='MATRIX')

        self.color = bpy.props.FloatVectorProperty(name="Color",
                                                   subtype='COLOR_GAMMA', min=0.0, max=1.0,
                                                   default=[0.0, 0.0, 0.0], update=self.on_color_update)

        self.strokes_ids = bpy.props.IntVectorProperty(name="Strokes", size=6, default=(0, 0, 0, 0, 0, 0))
Your operator should define bl_options = {"UNDO"}:

class MyOperator(bpy.types.Operator):
    bl_options = {"UNDO"}
    ...


See https://docs.blender.org/api/2.79/bpy.types.Operator.html?highlight=bl_options#bpy.types.Operator.bl_options