diff --git a/base/src/base/thread/trace.cc b/base/src/base/thread/trace.cc
index a19eb157f9..921c0660ce 100644
--- a/base/src/base/thread/trace.cc
+++ b/base/src/base/thread/trace.cc
@@ -16,6 +16,7 @@
#include
#include
#include
+#include
/* local includes */
#include
@@ -64,8 +65,20 @@ static Trace::Control *trace_control(Cpu_session *cpu, Rm_session *rm,
}
};
- static Area area(*cpu, *rm);
- return area.slot(thread_cap);
+ /**
+ * We have to construct the Area object explicitly because otherwise
+ * the destructor may use a invalid capability. This is mainly the
+ * case by e.g. forked processes in noux.
+ */
+
+ static char area_mem[sizeof (Area)];
+ static Area *area = 0;
+
+ if (!area) {
+ area = construct_at(area_mem, *cpu, *rm);
+ }
+
+ return area->slot(thread_cap);
}