Vulkan: Fix use-after-free crash on shutdown.

This commit is contained in:
Unknown W. Brackets
2018-04-29 09:47:39 -07:00
parent 1f73d78cc8
commit a85e914f78
+6 -1
View File
@@ -788,7 +788,12 @@ VKContext::VKContext(VulkanContext *vulkan, bool splitSubmit)
VKContext::~VKContext() {
allocator_->Destroy();
delete allocator_;
// We have to delete on queue, so this can free its queued deletions.
vulkan_->Delete().QueueCallback([](void *ptr) {
auto allocator = static_cast<VulkanDeviceAllocator *>(ptr);
delete allocator;
}, allocator_);
allocator_ = nullptr;
// This also destroys all descriptor sets.
for (int i = 0; i < VulkanContext::MAX_INFLIGHT_FRAMES; i++) {
frame_[i].descSets_.clear();