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

Bastien Montagne noreply at git.blender.org
Wed Sep 23 16:12:08 CEST 2015


Commit: d16ee90b9c92712c8c455c2293a15470fe2fe7d2
Author: Bastien Montagne
Date:   Mon Sep 21 15:01:55 2015 +0200
Branches: blender-v2.76-release
https://developer.blender.org/rBd16ee90b9c92712c8c455c2293a15470fe2fe7d2

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