From 60d37f690c54b5994939899d93bceb981c6bc2ee Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Tue, 15 Oct 2019 14:19:31 +0200 Subject: [PATCH] packet_stream_*: fix missing dissolve on exception When the construction of a member of Packet_stream_*::Rpc_object after the _cap member threw an exception, the object was not dissolved from the entrypoint although the Rpc_object vanished at this point. This was because the call to 'manage()' happened in the initializer list (for the _cap member instantiation). The destruction of the _cap member then did not dissolve the object. This first fix moves the call to 'manage()' into the constructor body after the instantiation of all other members. A more sophisticated fix would use some kind of 'Managed_object' life-time guard that manages an object on construction and dissolves on destruction. Ref #3525 --- repos/os/include/packet_stream_rx/rpc_object.h | 9 ++++++--- repos/os/include/packet_stream_tx/rpc_object.h | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/repos/os/include/packet_stream_rx/rpc_object.h b/repos/os/include/packet_stream_rx/rpc_object.h index 8366689ad..e3b255a54 100644 --- a/repos/os/include/packet_stream_rx/rpc_object.h +++ b/repos/os/include/packet_stream_rx/rpc_object.h @@ -26,7 +26,7 @@ class Packet_stream_rx::Rpc_object : public Genode::Rpc_object _cap; + Genode::Capability _cap { }; typename CHANNEL::Source _source; Genode::Signal_context_capability _sigh_ready_to_submit; @@ -48,11 +48,14 @@ class Packet_stream_rx::Rpc_object : public Genode::Rpc_object _cap; + Genode::Capability _cap { }; typename CHANNEL::Sink _sink; Genode::Signal_context_capability _sigh_ready_to_ack; @@ -46,12 +46,14 @@ class Packet_stream_tx::Rpc_object : public Genode::Rpc_object