mem_tracker: Do not increment iterator after delete
authorCourtney Goeltzenleuchter <courtney@LunarG.com>
Mon, 27 Apr 2015 21:00:47 +0000 (15:00 -0600)
committerCourtney Goeltzenleuchter <courtney@LunarG.com>
Wed, 29 Apr 2015 17:25:22 +0000 (11:25 -0600)
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

index dc3dda4..771feb8 100644 (file)
@@ -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<VkDeviceMemory>::iterator it = pQueueInfo->pMemRefList.begin(); it != pQueueInfo->pMemRefList.end(); ++it) {
+                for (list<VkDeviceMemory>::iterator it = pQueueInfo->pMemRefList.begin(); it != pQueueInfo->pMemRefList.end();) {
                     if ((*it) == pMems[i]) {
                         it = pQueueInfo->pMemRefList.erase(it);
+                    } else {
+                        ++it;
                     }
                 }
             }