Fix Scene datablocks being created with a real user while never having any real datab...
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 26 Sep 2016 14:35:52 +0000 (16:35 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Mon, 26 Sep 2016 14:37:17 +0000 (16:37 +0200)
Now using new system dedicated to that kind of cases, id_ensure_real_user(), instead.
That way, usercount of Scenes is handled correctly at deletion time.

Reported by @sergey over IRC, thanks.

source/blender/blenkernel/intern/scene.c

index acf6a3139898b41f7a90d36d6b238ec564e243bf..0d204461d166717b091b2febe718c7119d63c655 100644 (file)
@@ -819,6 +819,8 @@ Scene *BKE_scene_add(Main *bmain, const char *name)
        Scene *sce;
 
        sce = BKE_libblock_alloc(bmain, ID_SCE, name);
+       id_us_min(&sce->id);
+       id_us_ensure_real(&sce->id);
 
        BKE_scene_init(sce);