diff --git a/core/SystemStatusOsObserver.cpp b/core/SystemStatusOsObserver.cpp index 0f6d2289..8127e869 100644 --- a/core/SystemStatusOsObserver.cpp +++ b/core/SystemStatusOsObserver.cpp @@ -328,9 +328,12 @@ void SystemStatusOsObserver::notify(const list& dlist) for (auto client : clientSet) { unordered_set 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++; } }