Fix T53291: Deleting objects do not delete them from the blend file
[blender.git] / source / blender / blenkernel / intern / object.c
index 8fa4ebb8b3c4f9bece74f7df989d26730a736664..107e9299740a474ecc6e8bfc8c75a0ab1871f0b2 100644 (file)
@@ -706,6 +706,9 @@ Object *BKE_object_add_only_object(Main *bmain, int type, const char *name)
 
        ob = BKE_libblock_alloc(bmain, ID_OB, name, 0);
 
+       /* We increase object user count when linking to SceneCollections. */
+       id_us_min(&ob->id);
+
        /* default object vars */
        ob->type = type;