From f7c01e80762d27900c19b4316985244eed4c2948 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 23 Sep 2025 12:10:28 +0200 Subject: [PATCH] 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 --- source/blender/blenkernel/intern/idprop.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/idprop.cc b/source/blender/blenkernel/intern/idprop.cc index 1d9813193ad..2582de5fbf8 100644 --- a/source/blender/blenkernel/intern/idprop.cc +++ b/source/blender/blenkernel/intern/idprop.cc @@ -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)); } }