From feedbe4bb937985dcfe346319d575dac8606982b Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 7 Jan 2014 12:16:16 +0100 Subject: [PATCH] failsafe test: Fix destruction order --- os/src/test/failsafe/main.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/os/src/test/failsafe/main.cc b/os/src/test/failsafe/main.cc index 787cfc7bb..728a4d5a4 100644 --- a/os/src/test/failsafe/main.cc +++ b/os/src/test/failsafe/main.cc @@ -72,10 +72,17 @@ class Test_child : public Genode::Child_policy } } _resources; + /* + * The order of the following members is important. The services must + * appear before the child to ensure the correct order of destruction. + * I.e., the services must remain alive until the child has stopped + * executing. Otherwise, the child may hand out already destructed + * local services when dispatching an incoming session call. + */ Genode::Rom_connection _elf; - Genode::Child _child; Genode::Parent_service _log_service; Genode::Parent_service _rm_service; + Genode::Child _child; public: @@ -88,9 +95,9 @@ class Test_child : public Genode::Child_policy : _resources(sigh), _elf(elf_name), + _log_service("LOG"), _rm_service("RM"), _child(_elf.dataspace(), _resources.ram.cap(), - _resources.cpu.cap(), _resources.rm.cap(), &ep, this), - _log_service("LOG"), _rm_service("RM") + _resources.cpu.cap(), _resources.rm.cap(), &ep, this) { }