Fix (unreported) Invalid clearing handling in IDP_ResizeIDPArray.

This function would only call `IDP_FreePropertyContent` on the items it
is releasing from its buffer, when reducing the length of the array.

However, it needs to call `IDP_ClearProperty` instead, otherwise some
invalid 'dirty' data is kept in the released properties, e.g. the `len`
value for groups or arrays.

Not sure how this never bit us before, but the recent asserts added by
6cb2226f13 did trigger in that case, once the code was re-using these
released IDProps.

Pull Request: https://projects.blender.org/blender/blender/pulls/146326
This commit is contained in:
Bastien Montagne
2025-09-23 12:10:28 +02:00
parent 61c8c04fac
commit f7c01e8076

View File

@@ -158,7 +158,7 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
if (newlen <= prop->totallen) {
if (newlen < prop->len && prop->totallen - newlen < IDP_ARRAY_REALLOC_LIMIT) {
for (int i = newlen; i < prop->len; i++) {
IDP_FreePropertyContent(GETPROP(prop, i));
IDP_ClearProperty(GETPROP(prop, i));
}
prop->len = newlen;
@@ -174,7 +174,7 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
if (newlen < prop->len) {
/* newlen is smaller */
for (int i = newlen; i < prop->len; i++) {
IDP_FreePropertyContent(GETPROP(prop, i));
IDP_ClearProperty(GETPROP(prop, i));
}
}