diff options
| author | Gabríel Arthúr Pétursson <gabriel@system.is> | 2017-06-03 23:27:59 +0000 |
|---|---|---|
| committer | Chris Forbes <chrisf@ijw.co.nz> | 2017-06-07 14:57:20 -0700 |
| commit | 900135556fce1ecf6793267d4db4b423d7f009c1 (patch) | |
| tree | 5e3402d98fc1214ecd9765ccc9c17ba3313dd652 /layers/object_tracker.cpp | |
| parent | 6be9526304e7b7ea4f9bbbe91c84c03b842b457f (diff) | |
| download | usermoji-900135556fce1ecf6793267d4db4b423d7f009c1.tar.xz | |
layers: Free per-device and -instance data on destroy
Instance and device data are allocated by the first call to
GetLayerDataPtr in the corresponding vkCreate call. We need to delete
them when we're done with them. Introduce a FreeLayerDataPtr helper
function that assists with this task.
Deletes for dispatch tables were missing in a few places too. Add them.
Diffstat (limited to 'layers/object_tracker.cpp')
| -rw-r--r-- | layers/object_tracker.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/layers/object_tracker.cpp b/layers/object_tracker.cpp index 385042b6..9702c6a7 100644 --- a/layers/object_tracker.cpp +++ b/layers/object_tracker.cpp @@ -463,11 +463,12 @@ VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocati } layer_debug_report_destroy_instance(instance_data->report_data); - layer_data_map.erase(key); + FreeLayerDataPtr(key, layer_data_map); instanceExtMap.erase(pInstanceTable); lock.unlock(); ot_instance_table_map.erase(key); + delete pInstanceTable; } VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) { @@ -514,6 +515,9 @@ VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCall VkLayerDispatchTable *pDisp = get_dispatch_table(ot_device_table_map, device); pDisp->DestroyDevice(device, pAllocator); ot_device_table_map.erase(key); + delete pDisp; + + FreeLayerDataPtr(key, layer_data_map); } VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) { |
