diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-06-21 17:12:33 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-06-21 17:12:33 +0300 |
commit | e34ade4eb3b28a44d7bb1685a0fba32937c8982f (patch) | |
tree | 6549bf472888892a680ae5668ae979eb1b5ad263 | |
parent | 8dec4a0e7935f4dde9d64a370b860ab0a1cf582e (diff) |
Fix T48412: Blender 2.77a crashes on Undo in some specific multi-level linked libraries cases.
Good old dead-brain stupid error when iterating over a linked list from which you remove some items...
-rw-r--r-- | source/blender/blenloader/intern/readblenentry.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 3cae95d418e..b5ba9879057 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -411,11 +411,12 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil /* Even though directly used libs have been already moved to new main, indirect ones have not. * This is a bit annoying, but we have no choice but to keep them all for now - means some now unused * data may remain in memory, but think we'll have to live with it. */ - Main *libmain; + Main *libmain, *libmain_next; Main *newmain = bfd->main; ListBase new_mainlist = {newmain, newmain}; - for (libmain = oldmain->next; libmain; libmain = libmain->next) { + for (libmain = oldmain->next; libmain; libmain = libmain_next) { + libmain_next = libmain->next; /* Note that LIB_INDIRECT does not work with libraries themselves, so we use non-NULL parent * to detect indirect-linked ones... */ if (libmain->curlib && (libmain->curlib->parent != NULL)) { |