Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/vsg/vk/DescriptorPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ ref_ptr<DescriptorSet::Implementation> DescriptorPool::allocateDescriptorSet(Des

void DescriptorPool::freeDescriptorSet(ref_ptr<DescriptorSet::Implementation> dsi)
{
// keep this DescritporPool alive while we detach it from the DescriptorSet::Implementation
ref_ptr<DescriptorPool> keepAlive(this);
{
// swap ownership so that DescriptorSet::Implementation' reference is reset to null and while this DescriptorPool takes a reference to it.
// acquire lock within local scope so that subsequent dsi->_descriptorPool = {} call doesn't unref and (possibly) delete this DescriptorPool while lock still held.
std::scoped_lock<std::mutex> lock(mutex);
_recyclingList.push_back(dsi);
++_availableDescriptorSet;
accumulateBindings(_recycledDescriptorPoolSizes, dsi->_descriptorSetLayout, +1);
dsi->_descriptorPool = {};
}
dsi->_descriptorPool = {};
}

bool DescriptorPool::available(uint32_t& numSets, DescriptorPoolSizes& availableDescriptorPoolSizes) const
Expand Down
Loading