From 0faeca806c012cfb9e07e30254a1d7d1e6146b15 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 22 Apr 2020 11:22:31 +0200 Subject: 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. --- source/blender/blenloader/intern/readfile.c | 12 ++++++------ 1 file 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; -- cgit v1.2.3