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 <bastien@blender.org>2022-04-14 17:41:02 +0300
committerBastien Montagne <bastien@blender.org>2022-04-14 17:46:51 +0300
commitad245a25e235884ffb756f95e1d82f67f5197bf1 (patch)
tree5e97637bbfd5e0d0af83077e7e77d3f333bdf1b0 /source/blender/blenloader
parentc71013082d096968d33ba977a0fdbcfbfb0690d1 (diff)
Fix T85756: Adjust Last Operation panel is slow.
Extremely subttle bug that would only appear in some specific circumstances, would cause memfile undo writing code to falsely detect some ID as changed because it would get the wrong 'starting point' of comparison with existing previous memfile step. See T85756 for detailed explanation and reproducible case.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/writefile.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 490328106ca..2ae660ab1b6 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -611,11 +611,14 @@ static void mywrite_id_begin(WriteData *wd, ID *id)
if (wd->use_memfile) {
wd->mem.current_id_session_uuid = id->session_uuid;
- /* If current next memchunk does not match the ID we are about to write, try to find the
- * correct memchunk in the mapping using ID's session_uuid. */
+ /* If current next memchunk does not match the ID we are about to write, or is not the _first_
+ * one for said ID, try to find the correct memchunk in the mapping using ID's session_uuid. */
+ MemFileChunk *curr_memchunk = wd->mem.reference_current_chunk;
+ MemFileChunk *prev_memchunk = curr_memchunk != NULL ? curr_memchunk->prev : NULL;
if (wd->mem.id_session_uuid_mapping != NULL &&
- (wd->mem.reference_current_chunk == NULL ||
- wd->mem.reference_current_chunk->id_session_uuid != id->session_uuid)) {
+ (curr_memchunk == NULL || curr_memchunk->id_session_uuid != id->session_uuid ||
+ (prev_memchunk != NULL &&
+ (prev_memchunk->id_session_uuid == curr_memchunk->id_session_uuid)))) {
void *ref = BLI_ghash_lookup(wd->mem.id_session_uuid_mapping,
POINTER_FROM_UINT(id->session_uuid));
if (ref != NULL) {