diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-08 01:25:05 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-08 01:25:05 +0400 |
commit | c52c10d1781825290d56d27551b6a51b4ab85b40 (patch) | |
tree | 6b76bcef86d355c7aca4dc8b2623607e2cfa00d2 /source/blender | |
parent | e4964a347706e97f98043d80feff65769977c7bf (diff) |
append was using a freed Main pointer to refer to the curlib when instancing group objects and centering objects around the cursor.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f24de9c605d..0eb25a6b894 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12433,25 +12433,29 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in { 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 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in 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 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in *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) |