From 60f084e5726a7b9dfd88d5b583ab48e526e80a63 Mon Sep 17 00:00:00 2001 From: Courtney Goeltzenleuchter Date: Mon, 27 Apr 2015 15:00:47 -0600 Subject: mem_tracker: Do not increment iterator after delete The loop was blindly incrementing the iterator and it should not. In the delete case the loop should resume with the iterator returned by the delete as it's the next element in the list. --- layers/mem_tracker.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'layers') diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp index dc3dda4c..771feb8b 100644 --- a/layers/mem_tracker.cpp +++ b/layers/mem_tracker.cpp @@ -1101,9 +1101,11 @@ VK_LAYER_EXPORT VkResult VKAPI vkQueueRemoveMemReferences( layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, queue, 0, MEMTRACK_INVALID_QUEUE, "MEM", str); } else { for (uint32_t i = 0; i < count; i++) { - for (list::iterator it = pQueueInfo->pMemRefList.begin(); it != pQueueInfo->pMemRefList.end(); ++it) { + for (list::iterator it = pQueueInfo->pMemRefList.begin(); it != pQueueInfo->pMemRefList.end();) { if ((*it) == pMems[i]) { it = pQueueInfo->pMemRefList.erase(it); + } else { + ++it; } } } -- cgit v1.2.3