diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-06-01 14:09:45 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-06-01 14:12:41 +0300 |
commit | 1fc656391751a87a25b915f9841236cb9ba57cee (patch) | |
tree | 5aab8cd6d9ac397e56a69db177edc1a660baade5 /source/blender/blenloader/intern | |
parent | c8711b6f6f2293f2cbf530be38b75e274c75d9ca (diff) |
Fix T44894: Round two.
We cannot `direct_link_packedfile()` twice on a same address, because this tries to
map again pf->data address, which leads to nothing (NULL).
So now, since `ima->packedfile` and `ima->packedfiles` are mutually exclusive
in 'live' blender data anyway, we either read one or the other.
Tested from/to official 2.74 and current master, everything looks fine now.
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 68326a02da2..c3dbd260ea4 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1996,7 +1996,7 @@ static void direct_link_script(FileData *UNUSED(fd), Script *script) static PackedFile *direct_link_packedfile(FileData *fd, PackedFile *oldpf) { PackedFile *pf = newpackedadr(fd, oldpf); - + if (pf) { pf->data = newpackedadr(fd, pf->data); } @@ -3439,12 +3439,17 @@ static void direct_link_image(FileData *fd, Image *ima) link_list(fd, &(ima->views)); link_list(fd, &(ima->packedfiles)); - for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) { - imapf->packedfile = direct_link_packedfile(fd, imapf->packedfile); + if (ima->packedfiles.first) { + for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) { + imapf->packedfile = direct_link_packedfile(fd, imapf->packedfile); + } + ima->packedfile = NULL; + } + else { + ima->packedfile = direct_link_packedfile(fd, ima->packedfile); } ima->anims.first = ima->anims.last = NULL; - ima->packedfile = direct_link_packedfile(fd, ima->packedfile); ima->preview = direct_link_preview_image(fd, ima->preview); ima->stereo3d_format = newdataadr(fd, ima->stereo3d_format); ima->ok = 1; |