Skip to content

Commit

Permalink
fix: correct order of destruction in EchoForwarderToSerial. (philips-…
Browse files Browse the repository at this point in the history
…software#291)

* fix: Remove all observers of EchoForwarder on destruction of EchoForwarderToSerial before destroying subject EchoOnSerialCommunication.

* EchoInstantiation.hpp: extract EchoForwarder to an interface.

* fix: Remove EchoForwarder interface and turn EchoForwarderToSerial into a struct.
  • Loading branch information
EkelmansPh committed May 26, 2023
1 parent d0308cf commit 3267831
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions protobuf/echo/EchoInstantiation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,15 @@ namespace main_
};

template<std::size_t MessageSize, std::size_t MaxServices>
class EchoForwarderToSerial
: public EchoForwarder<MessageSize, MaxServices>
struct EchoForwarderToSerial
{
public:
EchoForwarderToSerial(services::Echo& from, hal::SerialCommunication& toSerial)
: EchoForwarder<MessageSize, MaxServices>(from, to)
, to(toSerial)
: to(toSerial)
, echoForwarder(from, to)
{}

private:
EchoOnSerialCommunication<MessageSize> to;
EchoForwarder<MessageSize, MaxServices> echoForwarder;
};
}

Expand Down

0 comments on commit 3267831

Please sign in to comment.