diff options
author | Bastien Montagne <bastien@blender.org> | 2021-03-12 11:43:17 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-03-12 11:46:11 +0300 |
commit | fe2ceef729a1a1013f7a8466318a12343a6a0e15 (patch) | |
tree | 91a7d90850f521d0f82a7adddf57815c750e6a8b /source/blender/blenkernel/intern/lib_id_delete.c | |
parent | 4781ab0969cdb4e39a2a9947f2b1a613b13b6235 (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel/intern/lib_id_delete.c')
-rw-r--r-- | source/blender/blenkernel/intern/lib_id_delete.c | 18 |
1 files changed, 13 insertions, 5 deletions
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)); } } } |