diff options
| author | Cody Northrop <cnorthrop@google.com> | 2016-07-12 11:43:32 -0600 |
|---|---|---|
| committer | Cody Northrop <cnorthrop@google.com> | 2016-07-12 13:56:52 -0600 |
| commit | f9760b8ef2ff145d67c8faa00371aa2538cb88f8 (patch) | |
| tree | 87b304d455d2044211b86c4ae6b429d4ec8314e3 /layers/unique_objects.h | |
| parent | ac0445e063c290d0569a254856366d0371033b4f (diff) | |
| download | usermoji-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.h | 4 |
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 |
