New Undo: Fix crash in some complex production files.
There is no guarantee that depsgraph is ran between two undo steps, so when re-using an existing data-block we should never wipe completly its recalc flags, but instead complement them with new ones from accumulated 'storage' as needed.
This commit is contained in:
parent
ad85989a3f
commit
d8b0b8d3db
|
@ -9418,19 +9418,21 @@ static BHead *read_libblock(FileData *fd,
|
|||
if (do_partial_undo) {
|
||||
/* Even though we re-use the old ID as-is, it does not mean that we are 100% safe from
|
||||
* needing some depsgraph updates for it (it could depend on another ID which address
|
||||
* did
|
||||
* not change, but which actual content might have been re-read from the memfile). */
|
||||
* did not change, but which actual content might have been re-read from the memfile).
|
||||
* IMPORTANT: Do not fully overwrite recalc flag here, depsgraph may not have been ran
|
||||
* yet for previous undo step(s), we do not want to erase flags set by those.
|
||||
*/
|
||||
if (fd->undo_direction < 0) {
|
||||
/* We are coming from the future (i.e. do an actual undo, and not a redo), we use our
|
||||
* old reused ID's 'accumulated recalc flags since last memfile undo step saving' as
|
||||
* recalc flags. */
|
||||
id_old->recalc = id_old->recalc_undo_accumulated;
|
||||
id_old->recalc |= id_old->recalc_undo_accumulated;
|
||||
}
|
||||
else {
|
||||
/* We are coming from the past (i.e. do a redo), we use the saved 'accumulated recalc
|
||||
* flags since last memfile undo step saving' from the newly read ID as recalc flags.
|
||||
*/
|
||||
id_old->recalc = id->recalc_undo_accumulated;
|
||||
id_old->recalc |= id->recalc_undo_accumulated;
|
||||
}
|
||||
/* There is no need to flush the depsgraph's CoWs here, since that ID's data itself did
|
||||
* not change. */
|
||||
|
|
Loading…
Reference in New Issue