Fix T102670: Crash after deleting attribute in edit mode

Since we free BMesh attributes by attempting on every domain,
sometimes the attribute wouldn't be found for a CustomData.
We avoid reallocating custom data blocks in that case, so we
need to pass the ownership of the "pool" back to the BMesh.
This commit is contained in:
Hans Goudey 2022-11-22 13:44:13 -06:00
parent fa8a59689b
commit 461cb550cc
Notes: blender-bot 2023-02-14 09:33:11 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3
Referenced by issue #102875, Crash when Undo after Removing color attribute
Referenced by issue #102670, Regression: Crash after deleting color attributes and switching mode
1 changed files with 4 additions and 0 deletions

View File

@ -907,6 +907,10 @@ bool BM_data_layer_free_named(BMesh *bm, CustomData *data, const char *name)
if (has_layer) {
update_data_blocks(bm, &olddata, data);
}
else {
/* Move pool ownership back to BMesh CustomData, no block reallocation. */
data->pool = olddata.pool;
}
if (olddata.layers) {
MEM_freeN(olddata.layers);