Snap for 5115288 from da6fcfd8a16404705ab0a3d4ddfb1f4282c2dac0 to pi-qpr2-release

Change-Id: I0c2023b5a8f8d8169dc961c5ca823feed659964a
diff --git a/sdm845/core/SystemStatusOsObserver.cpp b/sdm845/core/SystemStatusOsObserver.cpp
index 0f6d228..8127e86 100644
--- a/sdm845/core/SystemStatusOsObserver.cpp
+++ b/sdm845/core/SystemStatusOsObserver.cpp
@@ -328,9 +328,12 @@
             for (auto client : clientSet) {
                 unordered_set<DataItemId> dataItemIdsForThisClient(
                         mParent->mClientToDataItems.getValSet(client));
-                for (auto id : dataItemIdsForThisClient) {
-                    if (dataItemIdsToBeSent.find(id) == dataItemIdsToBeSent.end()) {
-                        dataItemIdsForThisClient.erase(id);
+                for (auto itr = dataItemIdsForThisClient.begin();
+                        itr != dataItemIdsForThisClient.end(); ) {
+                    if (dataItemIdsToBeSent.find(*itr) == dataItemIdsToBeSent.end()) {
+                        itr = dataItemIdsForThisClient.erase(itr);
+                    } else {
+                        itr++;
                     }
                 }