Fix (unreported) bad handling of ID usercount increment in remapping code.

While this only had minor potential effect, both code incrementing
usercount of newly remapped IDs were wrong.

Original one would by-pass any 'ensured user' handling, newer one would
systematically make the ID directly linked...

`id_us_plus_no_lib` is to be used here.
This commit is contained in:
Bastien Montagne 2022-04-29 16:33:48 +02:00
parent f44a34fc55
commit d779b15485
2 changed files with 4 additions and 3 deletions

View File

@ -86,7 +86,8 @@ struct IDRemapper {
}
if (options & ID_REMAP_APPLY_UPDATE_REFCOUNT) {
id_us_plus(*r_id_ptr);
/* Do not handle LIB_TAG_INDIRECT/LIB_TAG_EXTERN here. */
id_us_plus_no_lib(*r_id_ptr);
}
if (options & ID_REMAP_APPLY_ENSURE_REAL) {

View File

@ -131,8 +131,8 @@ static void foreach_libblock_remap_callback_apply(ID *id_owner,
id_us_min(old_id);
}
if (new_id != NULL && (force_user_refcount || (new_id->tag & LIB_TAG_NO_MAIN) == 0)) {
/* We do not want to handle LIB_TAG_INDIRECT/LIB_TAG_EXTERN here. */
new_id->us++;
/* Do not handle LIB_TAG_INDIRECT/LIB_TAG_EXTERN here. */
id_us_plus_no_lib(new_id);
}
}
else if (cb_flag & IDWALK_CB_USER_ONE) {