IDManagement: Add assert against no-main IDs passed to `BKE_id_delete`.

This high-level function can only deal with IDs in main, trying to use
it to delete/free a no-main ID does nothing.
This commit is contained in:
Bastien Montagne 2022-01-05 10:39:09 +01:00
parent 5df916f23f
commit 33400ffcc9
1 changed files with 3 additions and 0 deletions

View File

@ -350,6 +350,9 @@ static size_t id_delete(Main *bmain, const bool do_tagged_deletion)
void BKE_id_delete(Main *bmain, void *idv)
{
BLI_assert_msg((((ID *)idv)->tag & LIB_TAG_NO_MAIN) == 0,
"Cannot be used with IDs outside of Main");
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
((ID *)idv)->tag |= LIB_TAG_DOIT;