From: Hwankyu Jhun Date: Thu, 15 Aug 2019 07:01:49 +0000 (+0900) Subject: Fix invalid access X-Git-Tag: submit/tizen/20190818.234401~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b36b63abf095989b88f2b62f21babb499ac0606;p=platform%2Fcore%2Fappfw%2Fcomponent-based-application.git Fix invalid access While calling Exit(), the iterator is removed. Before calling Exit(), the iterator has to be the next iterator. Change-Id: I36f61cafbf81442dc12a2dbe32573f24e9da7458 Signed-off-by: Hwankyu Jhun --- diff --git a/component_based/base/component_manager_internal.cc b/component_based/base/component_manager_internal.cc index f2bee5b..8bb18c1 100644 --- a/component_based/base/component_manager_internal.cc +++ b/component_based/base/component_manager_internal.cc @@ -147,8 +147,11 @@ void ComponentManager::ExitAll() { if (inst_map_.empty()) return; - for (auto i = inst_map_.begin(); i != inst_map_.end(); i++) { + auto iter = inst_map_.begin(); + while (iter != inst_map_.end()) { + auto i = iter; LOGD("Exit instance(%s)", i->first.c_str()); + iter++; Exit(i->first); } }