[Bf-blender-cvs] [efee90959fa] uuid-undo-experiments-swap-reread-datablocks: undo-experiments: Fix dummy crash when using old undo system.

Bastien Montagne noreply at git.blender.org
Wed Mar 11 19:26:29 CET 2020


Commit: efee90959fa8dc18c1c15195cd74418f175e430a
Author: Bastien Montagne
Date:   Wed Mar 11 19:25:46 2020 +0100
Branches: uuid-undo-experiments-swap-reread-datablocks
https://developer.blender.org/rBefee90959fa8dc18c1c15195cd74418f175e430a

undo-experiments: Fix dummy crash when using old undo system.

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

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

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index c860ba2f191..9615b1f00b8 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -9219,23 +9219,26 @@ static BHead *read_libblock(FileData *fd,
             *r_id = id_old;
           }
 
-          /* Even though we re-use the old ID as-is, it does not mean that we are 100% safe from
-           * needing some depsgraph updates for it (it could depend on another ID which address did
-           * not change, but which actual content might have been re-read from the memfile). */
-          if (fd->undo_direction < 0) {
-            /* We are coming from the future (i.e. do an actual undo, and not a redo), we use our
-             * old reused ID's 'accumulated recalc flags since last memfile undo step saving' as
-             * recalc flags. */
-            id_old->recalc = id_old->recalc_undo_accumulated;
-          }
-          else {
-            /* We are coming from the past (i.e. do a redo), we use the saved 'accumulated recalc
-             * flags since last memfile undo step saving' from the newly read ID as recalc flags.
-             */
-            id_old->recalc = id->recalc_undo_accumulated;
+          if (do_partial_undo) {
+            /* Even though we re-use the old ID as-is, it does not mean that we are 100% safe from
+             * needing some depsgraph updates for it (it could depend on another ID which address
+             * did
+             * not change, but which actual content might have been re-read from the memfile). */
+            if (fd->undo_direction < 0) {
+              /* We are coming from the future (i.e. do an actual undo, and not a redo), we use our
+               * old reused ID's 'accumulated recalc flags since last memfile undo step saving' as
+               * recalc flags. */
+              id_old->recalc = id_old->recalc_undo_accumulated;
+            }
+            else {
+              /* We are coming from the past (i.e. do a redo), we use the saved 'accumulated recalc
+               * flags since last memfile undo step saving' from the newly read ID as recalc flags.
+               */
+              id_old->recalc = id->recalc_undo_accumulated;
+            }
+            /* There is no need to flush the depsgraph's CoWs here, since that ID's data itself did
+             * not change. */
           }
-          /* There is no need to flush the depsgraph's CoWs here, since that ID's data itself did
-           * not change. */
 
           MEM_freeN(id);
           oldnewmap_free_unused(fd->datamap);



More information about the Bf-blender-cvs mailing list