From 3fa9b08a5277b45e1787fcd80e71c806e523fade Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 6 Aug 2021 13:57:45 -0700 Subject: [PATCH] don't do a hashmap lookup while iterating the hashmap --- libs/matdbg/src/DebugServer.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/matdbg/src/DebugServer.cpp b/libs/matdbg/src/DebugServer.cpp index 8da80637d0..d9e867a9f6 100644 --- a/libs/matdbg/src/DebugServer.cpp +++ b/libs/matdbg/src/DebugServer.cpp @@ -563,9 +563,13 @@ const DebugServer::MaterialRecord* DebugServer::getRecord(const MaterialKey& key void DebugServer::updateActiveVariants() { if (mQueryCallback) { - for (auto& pair : mMaterialRecords) { - VariantList& result = mMaterialRecords[pair.first].activeVariants; - mQueryCallback(pair.second.userdata, &result); + auto curr = mMaterialRecords.begin(); + auto end = mMaterialRecords.end(); + while (curr != end) { + auto& value = curr.value(); + VariantList& result = value.activeVariants; + mQueryCallback(value.userdata, &result); + ++curr; } } }