aboutsummaryrefslogtreecommitdiff
path: root/layers/unique_objects.h
diff options
context:
space:
mode:
authorDustin Graves <dustin@lunarg.com>2016-04-29 11:55:43 -0600
committerTobin Ehlis <tobine@google.com>2016-04-29 12:17:14 -0600
commit0737226d2170be53c4e14aa3968d4386c7201c32 (patch)
treeda743c0a8c4a11df4d0fbbef7c243079da34f6a1 /layers/unique_objects.h
parentae03bdd4d1b5f0be535857d55afccd3e10a05d56 (diff)
downloadusermoji-0737226d2170be53c4e14aa3968d4386c7201c32.tar.xz
layers: Fix access violation
Move the get_dispatch_key(instance/device) call before calling the driver's vkDestroyDevice/vkDestroyInstance functions in unique_objects. This addresses an access violation error reported by Application Verifier on Windows due to the previously destroyed instance/device handle being dereferenced. Change-Id: I151d42fb8a897d9d3b3c988813108b0b6b5b6b0d
Diffstat (limited to 'layers/unique_objects.h')
-rw-r--r--layers/unique_objects.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/layers/unique_objects.h b/layers/unique_objects.h
index 0479e581..e2854508 100644
--- a/layers/unique_objects.h
+++ b/layers/unique_objects.h
@@ -166,8 +166,9 @@ VkResult explicit_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const
}
void explicit_DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) {
+ dispatch_key key = get_dispatch_key(instance);
get_dispatch_table(unique_objects_instance_table_map, instance)->DestroyInstance(instance, pAllocator);
- layer_data_map.erase(get_dispatch_key(instance));
+ layer_data_map.erase(key);
}
// Handle CreateDevice
@@ -219,8 +220,9 @@ VkResult explicit_CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *p
}
void explicit_DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
+ dispatch_key key = get_dispatch_key(device);
get_dispatch_table(unique_objects_device_table_map, device)->DestroyDevice(device, pAllocator);
- layer_data_map.erase(get_dispatch_key(device));
+ layer_data_map.erase(key);
}
VkResult explicit_CreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,