[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32365] trunk/blender/source/blender/ blenloader/intern/readfile.c: append was using a freed Main pointer to refer to the curlib when instancing group objects and centering objects around the cursor .

Campbell Barton ideasman42 at gmail.com
Thu Oct 7 23:25:06 CEST 2010


Revision: 32365
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32365
Author:   campbellbarton
Date:     2010-10-07 23:25:05 +0200 (Thu, 07 Oct 2010)

Log Message:
-----------
append was using a freed Main pointer to refer to the curlib when instancing group objects and centering objects around the cursor.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2010-10-07 16:41:42 UTC (rev 32364)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2010-10-07 21:25:05 UTC (rev 32365)
@@ -12433,25 +12433,29 @@
 {
 	Main *mainvar= CTX_data_main(C);
 	Scene *scene= CTX_data_scene(C);
+	Library *curlib;
 
 	/* make main consistent */
 	expand_main(*fd, mainl);
 
 	/* do this when expand found other libs */
 	read_libraries(*fd, &(*fd)->mainlist);
+	
+	curlib= mainl->curlib;
 
 	/* make the lib path relative if required */
 	if(flag & FILE_RELPATH) {
 
 		/* use the full path, this could have been read by other library even */
-		BLI_strncpy(mainl->curlib->name, mainl->curlib->filepath, sizeof(mainl->curlib->name));
+		BLI_strncpy(curlib->name, curlib->filepath, sizeof(curlib->name));
 		
 		/* uses current .blend file as reference */
-		BLI_path_rel(mainl->curlib->name, G.sce);
+		BLI_path_rel(curlib->name, G.sce);
 	}
 
 	blo_join_main(&(*fd)->mainlist);
 	mainvar= (*fd)->mainlist.first;
+	mainl= NULL; /* blo_join_main free's mainl, cant use anymore */
 
 	lib_link_all(*fd, mainvar);
 	lib_verify_nodetree(mainvar, 0);
@@ -12466,7 +12470,7 @@
 			if (flag & FILE_LINK) {
 				give_base_to_objects(mainvar, scene, NULL, 0);
 			} else {
-				give_base_to_objects(mainvar, scene, mainl->curlib, 1);
+				give_base_to_objects(mainvar, scene, curlib, 1);
 			}
 
 			if (flag & FILE_GROUP_INSTANCE) {
@@ -12486,7 +12490,7 @@
 		*fd = NULL;
 	}	
 
-	append_do_cursor(scene, mainl->curlib, flag);
+	append_do_cursor(scene, curlib, flag);
 }
 
 void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag)





More information about the Bf-blender-cvs mailing list