[Bf-blender-cvs] [eaa00daa347] temp-lineart-contained: Fix first part of T86501: Crash during resync process.

Bastien Montagne noreply at git.blender.org
Sat Mar 13 02:01:00 CET 2021


Commit: eaa00daa3472e14e5b8727749536f0acbb1b49af
Author: Bastien Montagne
Date:   Fri Mar 12 09:43:17 2021 +0100
Branches: temp-lineart-contained
https://developer.blender.org/rBeaa00daa3472e14e5b8727749536f0acbb1b49af

Fix first part of T86501: Crash during resync process.

Code would end up freeing some of the newly created overrides, which
were assigned to the matching linked ID's `newid` pointer, accessed
again further down the code.

Note that this is not a normal expected situation, and it won't give a
proper resync result anyway, but it might happen in some complicated
corner cases, and also quite often when dealing with older .blend files.

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

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

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

diff --git a/source/blender/blenkernel/intern/lib_id_delete.c b/source/blender/blenkernel/intern/lib_id_delete.c
index 1d7f89e1e8d..67b2e4429d6 100644
--- a/source/blender/blenkernel/intern/lib_id_delete.c
+++ b/source/blender/blenkernel/intern/lib_id_delete.c
@@ -300,11 +300,15 @@ static size_t id_delete(Main *bmain, const bool do_tagged_deletion)
          * links, this can lead to nasty crashing here in second, actual deleting loop.
          * Also, this will also flag users of deleted data that cannot be unlinked
          * (object using deleted obdata, etc.), so that they also get deleted. */
-        BKE_libblock_remap_locked(
-            bmain, id, NULL, ID_REMAP_FLAG_NEVER_NULL_USAGE | ID_REMAP_FORCE_NEVER_NULL_USAGE);
+        BKE_libblock_remap_locked(bmain,
+                                  id,
+                                  NULL,
+                                  (ID_REMAP_FLAG_NEVER_NULL_USAGE |
+                                   ID_REMAP_FORCE_NEVER_NULL_USAGE |
+                                   ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS));
         /* Since we removed ID from Main,
          * we also need to unlink its own other IDs usages ourself. */
-        BKE_libblock_relink_ex(bmain, id, NULL, NULL, 0);
+        BKE_libblock_relink_ex(bmain, id, NULL, NULL, ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS);
       }
     }
 
@@ -337,8 +341,12 @@ static size_t id_delete(Main *bmain, const bool do_tagged_deletion)
            * actual deleting loop.
            * Also, this will also flag users of deleted data that cannot be unlinked
            * (object using deleted obdata, etc.), so that they also get deleted. */
-          BKE_libblock_remap_locked(
-              bmain, id, NULL, ID_REMAP_FLAG_NEVER_NULL_USAGE | ID_REMAP_FORCE_NEVER_NULL_USAGE);
+          BKE_libblock_remap_locked(bmain,
+                                    id,
+                                    NULL,
+                                    (ID_REMAP_FLAG_NEVER_NULL_USAGE |
+                                     ID_REMAP_FORCE_NEVER_NULL_USAGE |
+                                     ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS));
         }
       }
     }



More information about the Bf-blender-cvs mailing list