[Bf-blender-cvs] [5c84907b429] uuid-id: Fix mistake in ghash handling code in new id_map' uuid thing.

Bastien Montagne noreply at git.blender.org
Mon Mar 2 16:59:22 CET 2020


Commit: 5c84907b429f735905c19eef4e222434a455b313
Author: Bastien Montagne
Date:   Mon Mar 2 16:58:50 2020 +0100
Branches: uuid-id
https://developer.blender.org/rB5c84907b429f735905c19eef4e222434a455b313

Fix mistake in ghash handling code in new id_map' uuid thing.

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

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

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

diff --git a/source/blender/blenkernel/intern/main_idmap.c b/source/blender/blenkernel/intern/main_idmap.c
index 2516263d058..42ba4559295 100644
--- a/source/blender/blenkernel/intern/main_idmap.c
+++ b/source/blender/blenkernel/intern/main_idmap.c
@@ -120,8 +120,10 @@ struct IDNameLib_Map *BKE_main_idmap_create(struct Main *bmain,
     id_map->uuid_map = BLI_ghash_int_new(__func__);
     FOREACH_MAIN_ID_BEGIN (bmain, id) {
       BLI_assert(id->session_uuid != BKE_MAIN_ID_UUID_UNSET);
-      void **id_ptr_v = BLI_ghash_lookup_p(id_map->uuid_map, POINTER_FROM_UINT(id->session_uuid));
-      BLI_assert(*id_ptr_v == NULL);
+      void **id_ptr_v;
+      const bool existing_key = BLI_ghash_ensure_p(
+          id_map->uuid_map, POINTER_FROM_UINT(id->session_uuid), &id_ptr_v);
+      BLI_assert(existing_key == false);
       *id_ptr_v = id;
     }
     FOREACH_MAIN_ID_END;



More information about the Bf-blender-cvs mailing list