Fix #126310: Recursive ID CleanUp operation wrongly deleting some used IDs.

Broken detection of isolated archipelagos of IDs lead to falsly detecting
some data as unused in some specific cases (when the entry point of the
archipelago was only used within that archipelago, but some other ID in
the archipelago had actual valid users outside of it).
This commit is contained in:
Bastien Montagne
2025-01-27 14:15:58 +01:00
parent 82c676676a
commit 90995f6c46

View File

@@ -912,7 +912,12 @@ static bool lib_query_unused_ids_tag_recurse(ID *id, UnusedIDsData &data)
id_relations->tags |= MAINIDRELATIONS_ENTRY_TAGS_PROCESSED;
}
return is_part_of_dependency_loop;
/* If that ID is part of a dependency loop, but it does have a valid user (which is not part of
* that loop), then that dependency loop does not form (or is not part of) an unused archipelago.
*
* In other words, this current `id` is used, and is therefore a valid user of the 'calling ID'
* from previous recursion level.. */
return is_part_of_dependency_loop && !has_valid_from_users;
}
static void lib_query_unused_ids_tag(UnusedIDsData &data)