[Bf-blender-cvs] [38ced52d343] master: Fix minor issue with new libraries ID usercount.

Bastien Montagne noreply at git.blender.org
Fri Feb 14 12:18:31 CET 2020


Commit: 38ced52d34328adf97ec30880ab49fbf53c13d46
Author: Bastien Montagne
Date:   Fri Feb 14 12:16:16 2020 +0100
Branches: master
https://developer.blender.org/rB38ced52d34328adf97ec30880ab49fbf53c13d46

Fix minor issue with new libraries ID usercount.

Library data-blocks are supposed to be tagged as 'real user', i.e.
have one virtual user, since nothing else actually uses (refcounts)
them. That was done in liblink code, but not for newly added ID-LI IDs
when linking from a new libblend file e.g.

===================================================================

M	source/blender/blenloader/intern/readfile.c

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 93352a1ec90..48416736ce3 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -680,6 +680,9 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab
   /* Important, consistency with main ID reading code from read_libblock(). */
   lib->id.us = ID_FAKE_USERS(lib);
 
+  /* Matches lib_link_library(). */
+  id_us_ensure_real(&lib->id);
+
   BLI_strncpy(lib->name, filepath, sizeof(lib->name));
   BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath));



More information about the Bf-blender-cvs mailing list