aboutsummaryrefslogtreecommitdiff
path: root/layers/unique_objects.h
diff options
context:
space:
mode:
authorCody Northrop <cnorthrop@google.com>2016-07-12 11:43:32 -0600
committerCody Northrop <cnorthrop@google.com>2016-07-12 13:56:52 -0600
commitf9760b8ef2ff145d67c8faa00371aa2538cb88f8 (patch)
tree87b304d455d2044211b86c4ae6b429d4ec8314e3 /layers/unique_objects.h
parentac0445e063c290d0569a254856366d0371033b4f (diff)
downloadusermoji-f9760b8ef2ff145d67c8faa00371aa2538cb88f8.tar.xz
layers: Don't use instance pointer after it has been destroyed
In unique_objects' explicit_DestroyInstance(), the recently introduced second get_dispatch_table() was using a destroyed instance as a lookup key, failing to find an entry (since the driver controls that memory and probably freed it), and was crashing consistently on PixelC. Instead, use the instance pointer to cleanup instanceExtMap before calling down to the ICD's DestroyInstance. Additionally, use the existing VkLayerInstanceDispatchTable* instead of calling get_dispatch_table() twice.
Diffstat (limited to 'layers/unique_objects.h')
-rw-r--r--layers/unique_objects.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/layers/unique_objects.h b/layers/unique_objects.h
index 398150a6..18a07acf 100644
--- a/layers/unique_objects.h
+++ b/layers/unique_objects.h
@@ -192,10 +192,10 @@ 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(key);
VkLayerInstanceDispatchTable *pDisp = get_dispatch_table(unique_objects_instance_table_map, instance);
instanceExtMap.erase(pDisp);
+ pDisp->DestroyInstance(instance, pAllocator);
+ layer_data_map.erase(key);
}
// Handle CreateDevice