diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-01-14 23:08:22 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-01-15 13:09:16 +0300 |
commit | f55a178db06d6c3bf06ae8c33525d6d1c48c9572 (patch) | |
tree | fba4c8a2de5505c0363ebcdbc4b9644b9c975889 /source/blender/blenkernel/intern | |
parent | f52d315c353f74d395f63c85ccd0a1659e929bd5 (diff) |
Cleanup: rename BKE_libblock_free_us to BKE_id_free_us.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library_remap.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/main.c | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh_convert.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 2 |
5 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index bd7757a29c6..e8e3b9229b6 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -534,7 +534,7 @@ static bool collection_object_remove(Main *bmain, Collection *collection, Object BKE_collection_object_cache_free(collection); if (free_us) { - BKE_libblock_free_us(bmain, ob); + BKE_id_free_us(bmain, ob); } else { id_us_min(&ob->id); diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index 2ee4e2890a1..cc7967a9bdd 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -811,6 +811,11 @@ void BKE_libblock_free_datablock(ID *id, const int UNUSED(flag)) * Complete ID freeing, extended version for corner cases. * Can override default (and safe!) freeing process, to gain some speed up. * + * At that point, given id is assumed to not be used by any other data-block already + * (might not be actually true, in case e.g. several inter-related IDs get freed together...). + * However, they might still be using (referencing) other IDs, this code takes care of it if + * \a LIB_TAG_NO_USER_REFCOUNT is not defined. + * * \param bmain Main database containing the freed ID, can be NULL in case it's a temp ID outside of any Main. * \param idv Pointer to ID to be freed. * \param flag Set of \a LIB_ID_FREE_... flags controlling/overriding usual freeing process, @@ -904,6 +909,8 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i /** * Complete ID freeing, should be usable in most cases (even for out-of-Main IDs). * + * See #BKE_id_free_ex description for full details. + * * \param bmain Main database containing the freed ID, can be NULL in case it's a temp ID outside of any Main. * \param idv Pointer to ID to be freed. */ @@ -912,7 +919,10 @@ void BKE_id_free(Main *bmain, void *idv) BKE_id_free_ex(bmain, idv, 0, true); } -void BKE_libblock_free_us(Main *bmain, void *idv) /* test users */ +/** + * Not really a freeing function by itself, it decrements usercount of given id, and only frees it if it reaches 0. + */ +void BKE_id_free_us(Main *bmain, void *idv) /* test users */ { ID *id = idv; diff --git a/source/blender/blenkernel/intern/main.c b/source/blender/blenkernel/intern/main.c index e231302f154..61be1579fcf 100644 --- a/source/blender/blenkernel/intern/main.c +++ b/source/blender/blenkernel/intern/main.c @@ -64,6 +64,7 @@ void BKE_main_free(Main *mainvar) ListBase *lbarray[MAX_LIBARRAY]; int a; + /* Since we are remonving whole main, no need to bother 'properly' (and slowly) removing each ID from it. */ const int free_flag = LIB_ID_FREE_NO_MAIN | LIB_ID_FREE_NO_UI_USER | LIB_ID_FREE_NO_USER_REFCOUNT; MEM_SAFE_FREE(mainvar->blen_thumb); diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c index 71c21bf3208..659177654d6 100644 --- a/source/blender/blenkernel/intern/mesh_convert.c +++ b/source/blender/blenkernel/intern/mesh_convert.c @@ -616,7 +616,7 @@ void BKE_mesh_from_nurbs_displist( cu->mat = NULL; cu->totcol = 0; - /* Do not decrement ob->data usercount here, it's done at end of func with BKE_libblock_free_us() call. */ + /* Do not decrement ob->data usercount here, it's done at end of func with BKE_id_free_us() call. */ ob->data = me; ob->type = OB_MESH; @@ -641,7 +641,7 @@ void BKE_mesh_from_nurbs_displist( BKE_id_free(bmain, cu); } else { - BKE_libblock_free_us(bmain, cu); + BKE_id_free_us(bmain, cu); } } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index ce4d60f6191..44d5b29d4aa 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3296,7 +3296,7 @@ bool BKE_object_shapekey_free(Main *bmain, Object *ob) key = *key_p; *key_p = NULL; - BKE_libblock_free_us(bmain, key); + BKE_id_free_us(bmain, key); return false; } |