fix API::exit issue

This commit is contained in:
Jinhao 2015-05-03 23:12:18 +08:00
parent e449cd5a24
commit 1b01493e9f

View File

@ -264,20 +264,18 @@ namespace API
if((wd->thread_id == tid) && (wd->root != root)) if((wd->thread_id == tid) && (wd->root != root))
{ {
root = wd->root; root = wd->root;
bool exists = false;
for (auto i = roots.cbegin(); i != roots.cend(); ++i) for (auto i = roots.cbegin(); i != roots.cend(); ++i)
{ {
if (*i == root) if (*i == root)
{ {
root = nullptr; exists = true;
break; break;
} }
} }
if (!root) if (!exists)
{
root = wd->root;
roots.push_back(root); roots.push_back(root);
}
} }
} }