diff options
| author | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-04-27 15:04:43 -0600 |
|---|---|---|
| committer | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-04-29 11:25:22 -0600 |
| commit | 769eeff3cfd22ae649199715f4c88af1cc5a818c (patch) | |
| tree | a47f0a3cc3dc664fdcb4e1b04d53f84c48075a18 /layers/draw_state.cpp | |
| parent | 60f084e5726a7b9dfd88d5b583ab48e526e80a63 (diff) | |
| download | usermoji-769eeff3cfd22ae649199715f4c88af1cc5a818c.tar.xz | |
draw_state: Fix Microsoft C++ iterator assert
The Microsoft Visual Studio vector library does not like this code:
delete (*ii).second->pCmds.back();
Internally, pCmds.back() does a pCmds.end() - 1 and since the
vector we are using (*ii).second->pCmds is not local, the library
throws an assert about the iterator being non-incrementable.
The assert if fixed by making a local copy of the vector and
working on that.
Diffstat (limited to 'layers/draw_state.cpp')
| -rwxr-xr-x[-rw-r--r--] | layers/draw_state.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index 5bfe41d4..8ab366fe 100644..100755 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -980,9 +980,11 @@ static GLOBAL_CB_NODE* getCBNode(VkCmdBuffer cb) static void deleteCmdBuffers() { for (unordered_map<VkCmdBuffer, GLOBAL_CB_NODE*>::iterator ii=cmdBufferMap.begin(); ii!=cmdBufferMap.end(); ++ii) { - while (!(*ii).second->pCmds.empty()) { - delete (*ii).second->pCmds.back(); - (*ii).second->pCmds.pop_back(); + vector<CMD_NODE*> cmd_node_list = (*ii).second->pCmds; + while (!cmd_node_list.empty()) { + CMD_NODE* cmd_node = cmd_node_list.back(); + delete cmd_node; + cmd_node_list.pop_back(); } delete (*ii).second; } |
