[Bf-blender-cvs] [735093dee84] master: Fix crashes from recent refactor rB131a758b6f88.
Bastien Montagne
noreply at git.blender.org
Fri Jan 22 17:37:14 CET 2021
Commit: 735093dee8400ea67bd46ce5a0e93ec80cc44745
Author: Bastien Montagne
Date: Fri Jan 22 17:35:47 2021 +0100
Branches: master
https://developer.blender.org/rB735093dee8400ea67bd46ce5a0e93ec80cc44745
Fix crashes from recent refactor rB131a758b6f88.
Much better to add a relation entry for all IDs, even if they are not
connected to any other ID.
===================================================================
M source/blender/blenkernel/intern/main.c
===================================================================
diff --git a/source/blender/blenkernel/intern/main.c b/source/blender/blenkernel/intern/main.c
index e55b05ce797..4a7636926e6 100644
--- a/source/blender/blenkernel/intern/main.c
+++ b/source/blender/blenkernel/intern/main.c
@@ -280,6 +280,17 @@ void BKE_main_relations_create(Main *bmain, const short flag)
FOREACH_MAIN_ID_BEGIN (bmain, id) {
const int idwalk_flag = IDWALK_READONLY |
((flag & MAINIDRELATIONS_INCLUDE_UI) != 0 ? IDWALK_INCLUDE_UI : 0);
+
+ /* Ensure all IDs do have an entry, even if they are not connected to any other. */
+ MainIDRelationsEntry **entry_p;
+ if (!BLI_ghash_ensure_p(bmain->relations->relations_from_pointers, id, (void ***)&entry_p)) {
+ *entry_p = MEM_callocN(sizeof(**entry_p), __func__);
+ (*entry_p)->session_uuid = id->session_uuid;
+ }
+ else {
+ BLI_assert((*entry_p)->session_uuid == id->session_uuid);
+ }
+
BKE_library_foreach_ID_link(
NULL, id, main_relations_create_idlink_cb, bmain->relations, idwalk_flag);
}
More information about the Bf-blender-cvs
mailing list