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
This commit is contained in:
Bastien Montagne 2022-07-21 18:11:13 +02:00
parent ef5b435e8f
commit a36f029459
1 changed files with 5 additions and 5 deletions

View File

@ -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);