logic: fixed crash when renaming the temp storage while it is still used

This commit is contained in:
mlangkabel
2018-07-10 14:14:48 +02:00
parent 58eb994a60
commit ee3bf41a27
9 changed files with 37 additions and 33 deletions
+6 -3
View File
@@ -8,7 +8,7 @@
TaskInjectStorage::TaskInjectStorage(
std::shared_ptr<StorageProvider> storageProvider,
std::shared_ptr<Storage> target
std::weak_ptr<Storage> target
)
: m_storageProvider(storageProvider)
, m_target(target)
@@ -26,8 +26,11 @@ Task::TaskState TaskInjectStorage::doUpdate(std::shared_ptr<Blackboard> blackboa
std::shared_ptr<IntermediateStorage> source = m_storageProvider->consumeLargestStorage();
if (source)
{
m_target->inject(source.get());
return STATE_SUCCESS;
if (std::shared_ptr<Storage> target = m_target.lock())
{
target->inject(source.get());
return STATE_SUCCESS;
}
}
}
else