From 8b09418e5641d20835dbb9f907cede1dc489a0b3 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Wed, 24 Oct 2012 18:33:24 +0200 Subject: [PATCH] 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. --- base-foc/src/platform/_main_parent_cap.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/base-foc/src/platform/_main_parent_cap.h b/base-foc/src/platform/_main_parent_cap.h index 5b91d24cf9..164a7cdc6b 100644 --- a/base-foc/src/platform/_main_parent_cap.h +++ b/base-foc/src/platform/_main_parent_cap.h @@ -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(Native_capability(i)); }