Fix crash issue(erase while iterating std list) 04/159604/2 devel/tizen
authorSomin Kim <somin926.kim@samsung.com>
Fri, 10 Nov 2017 05:55:29 +0000 (14:55 +0900)
committerSomin Kim <somin926.kim@samsung.com>
Fri, 10 Nov 2017 08:40:24 +0000 (17:40 +0900)
- when a requirement is satisfied during ContextDataRead()

Change-Id: Iad71212300aaa824e3dab3472268535ae1add16a
Signed-off-by: Somin Kim <somin926.kim@samsung.com>
src/server/state/ReqVerificationState.cpp

index a739015..f0dfffc 100644 (file)
@@ -50,15 +50,19 @@ bool ReqVerificationState::execute()
 
 void ReqVerificationState::contextDataReady(ContextPublisher* pubs, void* userData)
 {
-       for (auto it = __reqInfos.begin(); it != __reqInfos.end(); ++it) {
-               if ((*it).pubs != pubs)
+       for (auto it = __reqInfos.begin(); it != __reqInfos.end();) {
+               if ((*it).pubs != pubs) {
+                       ++it;
                        continue;
+               }
 
-               if (!(*((*it).req) <= pubs->getData()))
+               if (!(*((*it).req) <= pubs->getData())) {
+                       ++it;
                        continue;
+               }
 
                pubs->removeObserver(this);
-               __reqInfos.erase(it);
+               __reqInfos.erase(it++);
        }
 
        if (__inspectAll())