Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33b07ba9 authored by Greg Kaiser's avatar Greg Kaiser
Browse files

UsbTransportSniffer: Defensively use 'final'

UsbTransportSniffer invokes the virtual method Close() within
its destructor.  This usage is fine right now, but if a future
class inherited from UsbTransportSniffer and overrode the Close()
method, then this destructor would not act as expected.

To protect against this, we declare Close() 'final' in
UsbTransportSniffer, and add a comment.

Test: Treehugger
Change-Id: I6182d84e7caf67cb06f37c22c6203ad6d6e57f34
parent 662a3a6c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ class UsbTransportSniffer : public UsbTransport {

    virtual ssize_t Read(void* data, size_t len) override;
    virtual ssize_t Write(const void* data, size_t len) override;
    virtual int Close() override;
    virtual int Close() override final;  // note usage in destructor
    virtual int Reset() override;

    const std::vector<Event> Transfers();