From 939af799ae5438c97775b80dde12fe99ff763913 Mon Sep 17 00:00:00 2001 From: howsohazard <143410553+howsohazard@users.noreply.github.com> Date: Sat, 6 Jul 2024 09:00:46 -0400 Subject: [PATCH] 20788: Fixes crashes when performing updates to SBFDS when values are interned (#167) --- src/Amalgam/SeparableBoxFilterDataStore.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Amalgam/SeparableBoxFilterDataStore.cpp b/src/Amalgam/SeparableBoxFilterDataStore.cpp index 3563a4de..8ed360ee 100644 --- a/src/Amalgam/SeparableBoxFilterDataStore.cpp +++ b/src/Amalgam/SeparableBoxFilterDataStore.cpp @@ -180,12 +180,13 @@ void SeparableBoxFilterDataStore::RemoveEntity(Entity *entity, size_t entity_ind { auto &column_data = columnData[column_index]; - auto &val_to_overwrite = GetValue(entity_index, column_index); - auto type_to_overwrite = column_data->GetIndexValueType(entity_index); + auto &val_to_overwrite_raw = GetValue(entity_index, column_index); + auto type_to_overwrite_raw = column_data->GetIndexValueType(entity_index); + auto val_to_overwrite = column_data->GetResolvedValue(type_to_overwrite_raw, val_to_overwrite_raw); + auto type_to_overwrite = column_data->GetResolvedValueType(type_to_overwrite_raw); auto &raw_value_to_reassign = GetValue(entity_index_to_reassign, column_index); auto raw_value_type_to_reassign = column_data->GetIndexValueType(entity_index_to_reassign); - //need to resolve the value just in case things move around due to entity_index being deleted auto value_to_reassign = column_data->GetResolvedValue(raw_value_type_to_reassign, raw_value_to_reassign); auto value_type_to_reassign = column_data->GetResolvedValueType(raw_value_type_to_reassign); @@ -267,8 +268,8 @@ void SeparableBoxFilterDataStore::UpdateEntityLabel(Entity *entity, size_t entit //remove the label if no longer relevant if(IsColumnIndexRemovable(column_index)) RemoveColumnIndex(column_index); - - OptimizeColumn(column_index); + else + OptimizeColumn(column_index); } //populates distances_out with all entities and their distances that have a distance to target less than max_dist