Skip to content

Commit

Permalink
Merge pull request #10982 from unknownbrackets/vulkan-shutdown
Browse files Browse the repository at this point in the history
Vulkan: Fix use-after-free crash on shutdown
  • Loading branch information
hrydgard committed Apr 29, 2018
2 parents 3537569 + a85e914 commit 6c5a4bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ext/native/thin3d/thin3d_vulkan.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit 6c5a4bc

Please sign in to comment.