[Bf-blender-cvs] [85b2bce0373] master: BKE libremap: do not assert on identity pairs.

Bastien Montagne noreply at git.blender.org
Mon Feb 6 19:29:27 CET 2023


Commit: 85b2bce037369c8530fd4e2cdc79302e1df160a6
Author: Bastien Montagne
Date:   Mon Feb 6 18:52:49 2023 +0100
Branches: master
https://developer.blender.org/rB85b2bce037369c8530fd4e2cdc79302e1df160a6

BKE libremap: do not assert on identity pairs.

If identity pairs (i.e. old ID pointer being same as new one) was
forbidden, then this should be asserted against in code defining
remapping, not in code applying it.

But it is actually sometimes usefull to allow/use identity pairs, so
simply early-return on these instead of asserting.

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

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

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

diff --git a/source/blender/blenkernel/intern/lib_remap.c b/source/blender/blenkernel/intern/lib_remap.c
index 462ec2d9816..127459508c2 100644
--- a/source/blender/blenkernel/intern/lib_remap.c
+++ b/source/blender/blenkernel/intern/lib_remap.c
@@ -532,13 +532,16 @@ typedef struct LibblockRemapMultipleUserData {
 
 static void libblock_remap_foreach_idpair_cb(ID *old_id, ID *new_id, void *user_data)
 {
+  if (old_id == new_id) {
+    return;
+  }
+
   LibBlockRemapMultipleUserData *data = user_data;
   Main *bmain = data->bmain;
   const short remap_flags = data->remap_flags;
 
   BLI_assert(old_id != NULL);
   BLI_assert((new_id == NULL) || GS(old_id->name) == GS(new_id->name));
-  BLI_assert(old_id != new_id);
 
   if (free_notifier_reference_cb) {
     free_notifier_reference_cb(old_id);



More information about the Bf-blender-cvs mailing list