[Bf-blender-cvs] [df80aeb] master: Fix (unreported) Append/link code: All library datablocks could end with same name.

Bastien Montagne noreply at git.blender.org
Mon Sep 21 15:07:51 CEST 2015


Commit: df80aeb162ac5def465bb87d95abf851f014f616
Author: Bastien Montagne
Date:   Mon Sep 21 15:01:55 2015 +0200
Branches: master
https://developer.blender.org/rBdf80aeb162ac5def465bb87d95abf851f014f616

Fix (unreported) Append/link code: All library datablocks could end with same name.

This was broken since ages I think, did not really hurt since we usually never use libs' names
to access them. Rather bad behavior however, breaking a ground rule of our ID system!

And no real reason to add new libraries to new (split) Main at all, libraries are
never considered linked datablocks, which means they should always be in 'main' Main->library list.

Not a regression, but should be included in 2.76 imho.

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

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

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 55cadae..aeb3168 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -618,7 +618,9 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab
 	m = BKE_main_new();
 	BLI_addtail(mainlist, m);
 	
-	lib = BKE_libblock_alloc(m, ID_LI, "lib");
+	/* Add library datablock itself to 'main' Main, since libraries are **never** linked data.
+	 * Fixes bug where you could end with all ID_LI datablocks having the same name... */
+	lib = BKE_libblock_alloc(mainlist->first, ID_LI, "Lib");
 	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