base-foc: fix 'Genode::parent_cap()'

Replacing the local name of a capability index object which exists in the
capability map can destroy the AVL tree order of the capability map. With
this patch the outdated object gets removed from the map and a new object
gets inserted afterwards.

Fixes #435.
This commit is contained in:
Christian Prochaska 2012-10-24 18:33:24 +02:00 committed by Norman Feske
parent 5a88e106df
commit 8b09418e56
1 changed files with 4 additions and 2 deletions

View File

@ -32,8 +32,10 @@ namespace Genode {
* Update local name after a parent capability got reloaded via
* 'Platform_env::reload_parent_cap()'.
*/
if (i->id() != raw->local_name)
i->id(raw->local_name);
if (i->id() != raw->local_name) {
cap_map()->remove(i);
i = cap_map()->insert(raw->local_name, Fiasco::PARENT_CAP);
}
return reinterpret_cap_cast<Parent>(Native_capability(i));
}