diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-07-02 09:09:52 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-02 09:09:52 -0400 |
| commit | 54675a3541dbe52c08272101b19d963418327d1b (patch) | |
| tree | 29ba83ea972e9db064f199685df86f5da86fe2eb /tools/gfx/vulkan/vk-device-queue.cpp | |
| parent | 6cbb88fb86b1688b37106ac873d68a57def706f2 (diff) | |
Only call m_api functions if m_api has been validly set on dtor of VulkanDeviceQueue. (#1426)
Diffstat (limited to 'tools/gfx/vulkan/vk-device-queue.cpp')
| -rw-r--r-- | tools/gfx/vulkan/vk-device-queue.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tools/gfx/vulkan/vk-device-queue.cpp b/tools/gfx/vulkan/vk-device-queue.cpp index 10a3d0e3b..3b9e6cbcd 100644 --- a/tools/gfx/vulkan/vk-device-queue.cpp +++ b/tools/gfx/vulkan/vk-device-queue.cpp @@ -1,4 +1,4 @@ -// vk-device-queue.cpp +// vk-device-queue.cpp #include "vk-device-queue.h" #include <stdlib.h> @@ -10,17 +10,20 @@ using namespace Slang; VulkanDeviceQueue::~VulkanDeviceQueue() { - for (int i = 0; i < int(EventType::CountOf); ++i) + if (m_api) { - m_api->vkDestroySemaphore(m_api->m_device, m_semaphores[i], nullptr); - } + for (int i = 0; i < int(EventType::CountOf); ++i) + { + m_api->vkDestroySemaphore(m_api->m_device, m_semaphores[i], nullptr); + } - for (int i = 0; i < m_numCommandBuffers; i++) - { - m_api->vkFreeCommandBuffers(m_api->m_device, m_commandPool, 1, &m_commandBuffers[i]); - m_api->vkDestroyFence(m_api->m_device, m_fences[i].fence, nullptr); + for (int i = 0; i < m_numCommandBuffers; i++) + { + m_api->vkFreeCommandBuffers(m_api->m_device, m_commandPool, 1, &m_commandBuffers[i]); + m_api->vkDestroyFence(m_api->m_device, m_fences[i].fence, nullptr); + } + m_api->vkDestroyCommandPool(m_api->m_device, m_commandPool, nullptr); } - m_api->vkDestroyCommandPool(m_api->m_device, m_commandPool, nullptr); } SlangResult VulkanDeviceQueue::init(const VulkanApi& api, VkQueue queue, int queueIndex) |
