Permalink
Browse files

Fix another case where we trusted std::move to clear the origin, whic…

…h is not guaranteed.
  • Loading branch information...
hrydgard committed Dec 10, 2017
1 parent 91b089d commit cca4e0b2ca64d9bc1518233003d0f472bcfdccbc
Showing with 19 additions and 2 deletions.
  1. +17 −0 Common/Vulkan/VulkanContext.cpp
  2. +1 −1 Common/Vulkan/VulkanMemory.cpp
  3. +1 −1 Common/Vulkan/VulkanMemory.h
@@ -1039,6 +1039,8 @@ void VulkanDeleteList::Take(VulkanDeleteList &del) {
assert(pipelineCaches_.size() == 0);
assert(renderPasses_.size() == 0);
assert(framebuffers_.size() == 0);
assert(pipelineLayouts_.size() == 0);
assert(descSetLayouts_.size() == 0);
assert(callbacks_.size() == 0);
cmdPools_ = std::move(del.cmdPools_);
descPools_ = std::move(del.descPools_);
@@ -1056,6 +1058,21 @@ void VulkanDeleteList::Take(VulkanDeleteList &del) {
pipelineLayouts_ = std::move(del.pipelineLayouts_);
descSetLayouts_ = std::move(del.descSetLayouts_);
callbacks_ = std::move(del.callbacks_);
del.cmdPools_.clear();
del.descPools_.clear();
del.modules_.clear();
del.buffers_.clear();
del.images_.clear();
del.imageViews_.clear();
del.deviceMemory_.clear();
del.samplers_.clear();
del.pipelines_.clear();
del.pipelineCaches_.clear();
del.renderPasses_.clear();
del.framebuffers_.clear();
del.pipelineLayouts_.clear();
del.descSetLayouts_.clear();
del.callbacks_.clear();
}
void VulkanDeleteList::PerformDeletes(VkDevice device) {
@@ -353,7 +353,7 @@ void VulkanDeviceAllocator::ExecuteFree(FreeInfo *userdata) {
slab.allocSizes.erase(it);
} else {
// Ack, a double free?
Crash();
_assert_msg_(G3D, false, "Double free? Block missing at offset %d", userdata->offset);
}
found = true;
break;
@@ -180,7 +180,7 @@ class VulkanDeviceAllocator {
static void DispatchFree(void *userdata) {
auto freeInfo = static_cast<FreeInfo *>(userdata);
freeInfo->allocator->ExecuteFree(freeInfo);
freeInfo->allocator->ExecuteFree(freeInfo); // this deletes freeInfo
}
bool AllocateSlab(VkDeviceSize minBytes);

0 comments on commit cca4e0b

Please sign in to comment.