mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-19 03:06:39 +00:00
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
This commit is contained in:
parent
0ed5655086
commit
60d37f690c
@ -26,7 +26,7 @@ class Packet_stream_rx::Rpc_object : public Genode::Rpc_object<CHANNEL, Rpc_obje
|
||||
private:
|
||||
|
||||
Genode::Rpc_entrypoint &_ep;
|
||||
Genode::Capability<CHANNEL> _cap;
|
||||
Genode::Capability<CHANNEL> _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<CHANNEL, Rpc_obje
|
||||
Genode::Region_map &rm,
|
||||
Genode::Range_allocator &buffer_alloc,
|
||||
Genode::Rpc_entrypoint &ep)
|
||||
: _ep(ep), _cap(_ep.manage(this)), _source(ds, rm, buffer_alloc),
|
||||
: _ep(ep), _source(ds, rm, buffer_alloc),
|
||||
|
||||
/* init signal handlers with default handlers of source */
|
||||
_sigh_ready_to_submit(_source.sigh_ready_to_submit()),
|
||||
_sigh_ack_avail(_source.sigh_ack_avail()) { }
|
||||
_sigh_ack_avail(_source.sigh_ack_avail())
|
||||
{
|
||||
_cap = _ep.manage(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
|
@ -26,7 +26,7 @@ class Packet_stream_tx::Rpc_object : public Genode::Rpc_object<CHANNEL, Rpc_obje
|
||||
private:
|
||||
|
||||
Genode::Rpc_entrypoint &_ep;
|
||||
Genode::Capability<CHANNEL> _cap;
|
||||
Genode::Capability<CHANNEL> _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<CHANNEL, Rpc_obje
|
||||
Genode::Region_map &rm,
|
||||
Genode::Rpc_entrypoint &ep)
|
||||
:
|
||||
_ep(ep), _cap(_ep.manage(this)), _sink(ds, rm),
|
||||
_ep(ep), _sink(ds, rm),
|
||||
|
||||
/* init signal handlers with default handlers of sink */
|
||||
_sigh_ready_to_ack(_sink.sigh_ready_to_ack()),
|
||||
_sigh_packet_avail(_sink.sigh_packet_avail())
|
||||
{ }
|
||||
{
|
||||
_cap = _ep.manage(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
|
Loading…
Reference in New Issue
Block a user