Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2022-05-02 16:54:15 +0300
committerBastien Montagne <bastien@blender.org>2022-05-02 16:58:53 +0300
commit5188c14718c56e4d088d3c5bb3ce3ed9ed8b7bdc (patch)
treebcb1aa8480ba3f9790bce60f9e85c5c2242831f6 /source/blender/blenkernel/intern/lib_id_delete.c
parent263f56ba493ae3c9b87e4df095b158af9805d552 (diff)
Fix T97688: Deleting a scene with a scene strip causes the referenced scene to have zero users
Relinking code would weirdly enough allow clearing of extra/fake user status on IDs used by affected ID, which would be utterly wrong. Fairly unclear why this was working OK in reported case before rBa71a513def20, could not spot any obvious reason just from reading code... Also, in `libblock_remap_data_update_tags`, only transfer fake user status if `new_id` is not NULL (otherwise that would have removed that falg from `old_id`, without actually transferring it to anything).
Diffstat (limited to 'source/blender/blenkernel/intern/lib_id_delete.c')
-rw-r--r--source/blender/blenkernel/intern/lib_id_delete.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/lib_id_delete.c b/source/blender/blenkernel/intern/lib_id_delete.c
index ba5556c8b2d..904039d56c8 100644
--- a/source/blender/blenkernel/intern/lib_id_delete.c
+++ b/source/blender/blenkernel/intern/lib_id_delete.c
@@ -120,7 +120,7 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i
Key *key = ((flag & LIB_ID_FREE_NO_MAIN) == 0) ? BKE_key_from_id(id) : NULL;
if ((flag & LIB_ID_FREE_NO_USER_REFCOUNT) == 0) {
- BKE_libblock_relink_ex(bmain, id, NULL, NULL, 0);
+ BKE_libblock_relink_ex(bmain, id, NULL, NULL, ID_REMAP_SKIP_USER_CLEAR);
}
if ((flag & LIB_ID_FREE_NO_MAIN) == 0 && key != NULL) {
@@ -264,7 +264,12 @@ static size_t id_delete(Main *bmain, const bool do_tagged_deletion)
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, ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS);
+ BKE_libblock_relink_ex(
+ bmain,
+ id,
+ NULL,
+ NULL,
+ (ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS | ID_REMAP_SKIP_USER_CLEAR));
}
}