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.
This commit is contained in:
parent
f7374737ef
commit
0faeca806c
Notes:
blender-bot
2023-02-14 05:16:25 +01:00
Referenced by issue #75919, Undo system: Debug assert while undoing several operations
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue