Vulkan: Fix Destroy() method of object not resetting the internal pointer
Leading to double-delete if Delete() was explictly called Former-commit-id: 0f42bc70913b64eb60193035ae15285fcc8c88ad [formerly 6d8b0e87e7b2edfb2052671a059863b3ce439fcc] Former-commit-id: 2806bd83474c0c12fb88b9562b6baf71cc7692c1
This commit is contained in:
parent
c75f3ce28b
commit
baa0dc3e3d
|
|
@ -29,6 +29,8 @@ namespace Nz
|
|||
{
|
||||
vkDeviceWaitIdle(m_device);
|
||||
vkDestroyDevice(m_device, (m_allocator.pfnAllocation) ? &m_allocator : nullptr);
|
||||
|
||||
m_device = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,10 @@ namespace Nz
|
|||
inline void DeviceObject<C, VkType, CreateInfo>::Destroy()
|
||||
{
|
||||
if (m_handle != VK_NULL_HANDLE)
|
||||
{
|
||||
C::DestroyHelper(m_device, m_handle, (m_allocator.pfnAllocation) ? &m_allocator : nullptr);
|
||||
m_handle = VK_NULL_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename C, typename VkType, typename CreateInfo>
|
||||
|
|
|
|||
|
|
@ -50,7 +50,10 @@ namespace Nz
|
|||
inline void Instance::Destroy()
|
||||
{
|
||||
if (m_instance)
|
||||
{
|
||||
vkDestroyInstance(m_instance, (m_allocator.pfnAllocation) ? &m_allocator : nullptr);
|
||||
m_instance = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
inline PFN_vkVoidFunction Instance::GetDeviceProcAddr(VkDevice device, const char* name)
|
||||
|
|
|
|||
|
|
@ -165,7 +165,10 @@ namespace Nz
|
|||
inline void Surface::Destroy()
|
||||
{
|
||||
if (m_surface != VK_NULL_HANDLE)
|
||||
{
|
||||
m_instance.vkDestroySurfaceKHR(m_instance, m_surface, (m_allocator.pfnAllocation) ? &m_allocator : nullptr);
|
||||
m_surface = VK_NULL_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
inline VkResult Surface::GetLastErrorCode() const
|
||||
|
|
|
|||
Loading…
Reference in New Issue