Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <b.mont29@gmail.com>2020-04-03 17:07:27 +0300
committerBastien Montagne <b.mont29@gmail.com>2020-04-03 17:07:27 +0300
commitd8b0b8d3db6b2953db33d80390f1789f8700e145 (patch)
tree5ffc773a022e5c2d2cb497ce817d25bd86afb047
parentad85989a3f8825eba990b73ce0ee59d71d9b585c (diff)
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.
-rw-r--r--source/blender/blenloader/intern/readfile.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 6bc920c26f9..739c816ad45 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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. */