diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-18 18:48:31 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-18 18:51:48 +0300 |
commit | 91ffd39e77498b81634750527aa5069c950a4d59 (patch) | |
tree | 83c43c238ff47b6673015a98792a692cdb5f7dd4 /source/blender | |
parent | d1f04658d855a6fdf038aa80ad656228077b0d46 (diff) |
Fix T62706: Orphan Data : I have now to save a file, close and reopen it, only then I can purge previous deleted meshes.
libquery code has some specific handling for IDs tagged as 'no_main',
among which to never consider them as refcounted/refcounting other IDs.
This is fine, but it also means we have to be careful when moving an ID
from main to out-of-main status, to do all id remapping we need
//before// we tag it as no_main.
That was a bit tedious to track down, we'll have to be careful that all
the corner cases we have to take care of, do not end up in a giant soup
of expections to exceptions, where nobody can find its way anymore...
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/library_remap.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index 04ccdc729da..d4e30bc07e9 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -1001,7 +1001,9 @@ static void id_delete(Main *bmain, const bool do_tagged_deletion) if ((id->tag & tag) || (id->lib != NULL && (id->lib->id.tag & tag))) { BLI_remlink(lb, id); BLI_addtail(&tagged_deleted_ids, id); - id->tag |= tag | LIB_TAG_NO_MAIN; + /* Do not tag as no_main now, we want to unlink it first (lower-level ID management code + * has some specific handling of 'nom main' IDs that would be a problem in that case). */ + id->tag |= tag; keep_looping = true; } } @@ -1021,6 +1023,8 @@ static void id_delete(Main *bmain, const bool do_tagged_deletion) ID_REMAP_FLAG_NEVER_NULL_USAGE | ID_REMAP_FORCE_NEVER_NULL_USAGE); /* 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, true); + /* Now we can safely mark that ID as not being in Main database anymore. */ + id->tag |= LIB_TAG_NO_MAIN; /* This is needed because we may not have remapped usages of that ID by other deleted ones. */ // id->us = 0; /* Is it actually? */ } |