diff options
author | Bastien Montagne <bastien@blender.org> | 2020-04-22 12:22:31 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-04-22 12:37:09 +0300 |
commit | 0faeca806c012cfb9e07e30254a1d7d1e6146b15 (patch) | |
tree | 822fc244338dd3b46cdb55b39deca43fb7b9efe4 | |
parent | f7374737ef8b2044a214d8b2b5d40f1cc21f00eb (diff) |
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.
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 12 |
1 files changed, 6 insertions, 6 deletions
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; |