[Bf-blender-cvs] [405f7c237dd] uuid-undo-experiments-swap-reread-datablocks: undo-experiments: Fix crashes in depsgraph updates.

Bastien Montagne noreply at git.blender.org
Thu Mar 12 16:09:37 CET 2020


Commit: 405f7c237dd49643b2c612d2bd61241ad27a4a27
Author: Bastien Montagne
Date:   Thu Mar 12 16:06:54 2020 +0100
Branches: uuid-undo-experiments-swap-reread-datablocks
https://developer.blender.org/rB405f7c237dd49643b2c612d2bd61241ad27a4a27

undo-experiments: Fix crashes in depsgraph updates.

AFAIK there are no more crashes related to that issue now (although this
is hard to fully test, so...).

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

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

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 9615b1f00b8..251afdc54c9 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2771,6 +2771,13 @@ static void direct_link_id(FileData *fd, ID *id, ID *id_old)
     /* In any case, we need to flush the depsgraph's CoWs, as even if the ID address itself did not
      * change, internal data most likely have. */
     id->recalc |= ID_RECALC_COPY_ON_WRITE;
+
+    /* We need to 'accumulate' the accumulated recalc flags of all undo steps until we actually
+     * perform a depsgraph update, otherwise we'd only ever use the flags from one of the steps,
+     * and never get proper flags matching all others. */
+    if (id_old != NULL) {
+      id->recalc_undo_accumulated |= id_old->recalc_undo_accumulated;
+    }
   }
 
   /* Link direct data of overrides. */
@@ -9238,6 +9245,11 @@ static BHead *read_libblock(FileData *fd,
             }
             /* There is no need to flush the depsgraph's CoWs here, since that ID's data itself did
              * not change. */
+
+            /* We need to 'accumulate' the accumulated recalc flags of all undo steps until we
+             * actually perform a depsgraph update, otherwise we'd only ever use the flags from one
+             * of the steps, and never get proper flags matching all others. */
+            id_old->recalc_undo_accumulated |= id->recalc_undo_accumulated;
           }
 
           MEM_freeN(id);



More information about the Bf-blender-cvs mailing list