[Bf-blender-cvs] [a36f029459f] master: Fix crash in some very rare case in remapping code.

Bastien Montagne noreply at git.blender.org
Thu Jul 21 18:15:09 CEST 2022


Commit: a36f029459f34acb457c566d0d95e058122623f1
Author: Bastien Montagne
Date:   Thu Jul 21 18:11:13 2022 +0200
Branches: master
https://developer.blender.org/rBa36f029459f34acb457c566d0d95e058122623f1

Fix crash in some very rare case in remapping code.

Actualy 'safe' building of the base has in view layers (as part of
`BKE_main_collection_sync_remap`) would only happen when there was
already an existing one, otherwise it was skipped, and rebuilt later
(without the support for doublons) in collection sync code.

Very odd that that error was never spotted before, issue in code has
been there for a long time already. Probably only happens in rare cases
(specific conjuction of factors during remapping of old ID into itelf
new id)?

Reported by @hjalti from Blender studio. Reproducing case:
`heist/pro/shots/050_alarm/050_0160/050_0160.anim.blend`, r1407

===================================================================

M	source/blender/blenkernel/intern/layer.c

===================================================================

diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 534ff7f1fbc..ac582ff69ca 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1377,12 +1377,12 @@ void BKE_main_collection_sync_remap(const Main *bmain)
       if (view_layer->object_bases_hash) {
         BLI_ghash_free(view_layer->object_bases_hash, NULL, NULL);
         view_layer->object_bases_hash = NULL;
-
-        /* Directly re-create the mapping here, so that we can also deal with duplicates in
-         * `view_layer->object_bases` list of bases properly. This is the only place where such
-         * duplicates should be fixed, and not considered as a critical error. */
-        view_layer_bases_hash_create(view_layer, true);
       }
+
+      /* Directly re-create the mapping here, so that we can also deal with duplicates in
+       * `view_layer->object_bases` list of bases properly. This is the only place where such
+       * duplicates should be fixed, and not considered as a critical error. */
+      view_layer_bases_hash_create(view_layer, true);
     }
 
     BKE_collection_object_cache_free(scene->master_collection);



More information about the Bf-blender-cvs mailing list