Fix #125720: crash when showing simulated instances in spreadsheet

This commit is contained in:
Jacques Lucke
2024-08-01 11:30:22 +02:00
parent b00a16b4e1
commit add8e42bac

View File

@@ -137,7 +137,7 @@ Instances::Instances(Instances &&other)
Instances::Instances(const Instances &other)
: references_(other.references_),
instances_num_(other.instances_num_),
reference_user_counts_(std::move(other.reference_user_counts_)),
reference_user_counts_(other.reference_user_counts_),
almost_unique_ids_cache_(other.almost_unique_ids_cache_)
{
CustomData_copy(&other.attributes_, &attributes_, CD_MASK_ALL, other.instances_num_);
@@ -183,6 +183,7 @@ void Instances::add_instance(const int instance_handle, const float4x4 &transfor
CustomData_realloc(&attributes_, old_size, instances_num_);
this->reference_handles_for_write().last() = instance_handle;
this->transforms_for_write().last() = transform;
this->tag_reference_handles_changed();
}
Span<int> Instances::reference_handles() const
@@ -246,6 +247,7 @@ int Instances::add_reference(const InstanceReference &reference)
if (std::optional<int> handle = this->find_reference_handle(reference)) {
return *handle;
}
this->tag_reference_handles_changed();
return references_.append_and_get_index(reference);
}