[Bf-blender-cvs] [0faeca806c0] blender-v2.83-release: Fix T75719: Undo system: Debug assert while undoing several operations.

Bastien Montagne noreply at git.blender.org
Wed Apr 22 11:37:16 CEST 2020


Commit: 0faeca806c012cfb9e07e30254a1d7d1e6146b15
Author: Bastien Montagne
Date:   Wed Apr 22 11:22:31 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB0faeca806c012cfb9e07e30254a1d7d1e6146b15

Fix T75719: Undo system: Debug assert while undoing several operations.

Caused by some pointer collision when re-allocating data-blocks during
undo (due to creation/deletion of those).

Patch by @brecht, many thanks.

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

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

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index f64a0e48855..83d14761daa 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -9656,10 +9656,10 @@ static bool read_libblock_undo_restore(
     const int id_tag = tag | LIB_TAG_NEED_LINK | LIB_TAG_UNDO_OLD_ID_REUSED;
     read_libblock_undo_restore_identical(fd, main, id, id_old, id_tag);
 
-    /* Insert into library map for lookup by newly read datablocks (with pointer
-     * value bhead->old) or existing datablocks in memory (pointer value id_old). */
+    /* Insert into library map for lookup by newly read datablocks (with pointer value bhead->old).
+     * Note that existing datablocks in memory (which pointer value would be id_old) are not
+     * remapped anymore, so no need to store this info here. */
     oldnewmap_insert(fd->libmap, bhead->old, id_old, bhead->code);
-    oldnewmap_insert(fd->libmap, id_old, id_old, bhead->code);
 
     *r_id_old = id_old;
     return true;
@@ -9730,11 +9730,11 @@ static BHead *read_libblock(FileData *fd,
    * direct_link_library() may remove it from there in case of duplicates. */
   BLI_addtail(lb, id);
 
-  /* Insert into library map for lookup by newly read datablocks (with pointer
-   * value bhead->old) or existing datablocks in memory (pointer value id_old). */
+  /* Insert into library map for lookup by newly read datablocks (with pointer value bhead->old).
+   * Note that existing datablocks in memory (which pointer value would be id_old) are not remapped
+   * remapped anymore, so no need to store this info here. */
   ID *id_target = id_old ? id_old : id;
   oldnewmap_insert(fd->libmap, bhead->old, id_target, bhead->code);
-  oldnewmap_insert(fd->libmap, id_old, id_target, bhead->code);
 
   if (r_id) {
     *r_id = id_target;



More information about the Bf-blender-cvs mailing list