Fixed early ticket delete crash

This commit fixes a crash that could happen when a spawnable ticket was deleted before all requests in the queue had completed. Because of this crash the requests now only hold on to the payload of the ticket but not the ticket itself. As a side effect, callbacks can no longer provide the ticket itself so instead a unique id for the ticket is returned.
This commit is contained in:
AMZN-koppersr
2021-05-26 14:26:16 -07:00
parent 76827ff95e
commit e0948a26bc
6 changed files with 242 additions and 96 deletions
@@ -70,7 +70,7 @@ namespace AzFramework
SpawnableEntitiesInterface::Get()->Barrier(
m_threadData->m_spawnedEntitiesTicket,
SpawnablePriorty_Default,
[threadData = m_threadData](EntitySpawnTicket&) mutable
[threadData = m_threadData](EntitySpawnTicket::Id) mutable
{
threadData.reset();
});
@@ -89,7 +89,7 @@ namespace AzFramework
SpawnableEntitiesInterface::Get()->Barrier(
m_threadData->m_spawnedEntitiesTicket,
SpawnablePriorty_Default,
[generation = m_threadData->m_generation, callback = AZStd::move(callback)](EntitySpawnTicket&)
[generation = m_threadData->m_generation, callback = AZStd::move(callback)](EntitySpawnTicket::Id)
{
callback(generation);
});