diff options
| author | Ian Elliott <ianelliott@google.com> | 2016-05-05 14:10:49 -0600 |
|---|---|---|
| committer | Ian Elliott <ianelliott@google.com> | 2016-05-05 14:16:06 -0600 |
| commit | 7d1383878ecda994f126b2bff9f77f22051348f4 (patch) | |
| tree | 067e5d3576f9225db4af8e142b44c4b977fb64e2 /layers/core_validation.cpp | |
| parent | facee8b3b0b15fc345cacab9a3a028636b131995 (diff) | |
| download | usermoji-7d1383878ecda994f126b2bff9f77f22051348f4.tar.xz | |
layers: #471 swapchin layer to use find() for map lookups
This fixes a long-standing (day-1) defect in the swapchain layer (perhaps
cloned from another layer at the time?). Several unordered maps are used to
keep track of things. The layer was using the [] operator for both adding a
new entry to a map, and for looking up entries that should already be in a map.
This latter usage is where the bug is. If a handle is passed in that hasn't
been seen before, the use of the [] operator will add a new entry to the
map--one that hasn't been initialized. The new EnableWsiBeforeUse test caused
a crash in the swapchain layer when it used VK_NULL_HANDLE.
The new code uses the find() element-lookup function of the unordere map class,
and compares this to end(). If the found value is equal to end() (i.e. it
currently isn't in the map), NULL is used for the pointer (the desired behavior
in the swapchain layer).
Two new macros were used in order to keep the code minimal and consistent in
its use of find()/end().
Diffstat (limited to 'layers/core_validation.cpp')
0 files changed, 0 insertions, 0 deletions
