Commit: fe2ceef729a1a1013f7a8466318a12343a6a0e15
Author: Bastien Montagne
Date:   Fri Mar 12 09:43:17 2021 +0100
Branches: master
https://developer.blender.org/rBfe2ceef729a1a1013f7a8466318a12343a6a0e15

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

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to