Commit: e34ade4eb3b28a44d7bb1685a0fba32937c8982f
Author: Bastien Montagne
Date:   Tue Jun 21 16:12:33 2016 +0200
Branches: master
https://developer.blender.org/rBe34ade4eb3b28a44d7bb1685a0fba32937c8982f

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...

===================================================================

M       source/blender/blenloader/intern/readblenentry.c

===================================================================

diff --git a/source/blender/blenloader/intern/readblenentry.c 
b/source/blender/blenloader/intern/readblenentry.c
index 3cae95d..b5ba987 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)) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to