[Bf-blender-cvs] [0425faafe27] undo-experiments: Fix stupid misplacement of depsgraphs extraction/restoration.

Bastien Montagne noreply at git.blender.org
Tue Dec 10 16:01:31 CET 2019


Commit: 0425faafe272a99cba5a88fbf6c73916b14ded75
Author: Bastien Montagne
Date:   Tue Dec 10 11:58:22 2019 +0100
Branches: undo-experiments
https://developer.blender.org/rB0425faafe272a99cba5a88fbf6c73916b14ded75

Fix stupid misplacement of depsgraphs extraction/restoration.

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

M	source/blender/blenkernel/intern/undo_system.c

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

diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index eee07437aa7..0a487c7bdf1 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -192,15 +192,11 @@ static void undosys_step_decode(
             /* Common case, we're already using the last memfile state. */
           }
           else {
-            GHash *depsgraphs = BKE_scene_undo_depsgraphs_extract(bmain);
-
             /* Load the previous memfile state so any ID's referenced in this
              * undo step will be correctly resolved, see: T56163. */
             undosys_step_decode(C, bmain, ustack, us_iter, dir, false);
             /* May have been freed on memfile read. */
             bmain = G_MAIN;
-
-            BKE_scene_undo_depsgraphs_restore(bmain, depsgraphs);
           }
           break;
         }
@@ -212,10 +208,18 @@ static void undosys_step_decode(
     us->type->step_foreach_ID_ref(us, undosys_id_ref_resolve, bmain);
   }
 
+  /* Extract depsgraphs from current bmain (which may be freed during undo step reading),
+   * and store them for re-use. */
+  GHash *depsgraphs = BKE_scene_undo_depsgraphs_extract(bmain);
+
   UNDO_NESTED_CHECK_BEGIN;
   us->type->step_decode(C, bmain, us, dir, is_final);
   UNDO_NESTED_CHECK_END;
 
+  /* Restore previous depsgraphs into current bmain. */
+  bmain = G_MAIN;
+  BKE_scene_undo_depsgraphs_restore(bmain, depsgraphs);
+
 #ifdef WITH_GLOBAL_UNDO_CORRECT_ORDER
   if (us->type == BKE_UNDOSYS_TYPE_MEMFILE) {
     ustack->step_active_memfile = us;



More information about the Bf-blender-cvs mailing list