Skip to content

Commit c6fc665

Browse files
committed
Merge #12680: Add missing virtual destructor in PeerLogicValidation
2b3ea39 Polish interfaces around PeerLogicValidation (Vasil Dimov) Pull request description: Silence the following compiler warning: /usr/include/c++/v1/memory:2285:5: error: delete called on non-final 'PeerLogicValidation' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor] delete __ptr; ^ /usr/include/c++/v1/memory:2598:7: note: in instantiation of member function 'std::__1::default_delete<PeerLogicValidation>::operator()' requested here __ptr_.second()(__tmp); ^ init.cpp:201:15: note: in instantiation of member function 'std::__1::unique_ptr<PeerLogicValidation, std::__1::default_delete<PeerLogicValidation> >::reset' requested here peerLogic.reset(); ^ Tree-SHA512: 0e5ead0da2da76a5276cd45e28ddfa4b92cc7225fa154a2662aad88e7210acd17b81431c98e90a2c7be08d39f8689f1d9982cdb18297d4bb0b6195ae40c7ec17
2 parents 6acd870 + 2b3ea39 commit c6fc665

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/net.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,13 @@ class NetEventsInterface
469469
virtual bool SendMessages(CNode* pnode, std::atomic<bool>& interrupt) = 0;
470470
virtual void InitializeNode(CNode* pnode) = 0;
471471
virtual void FinalizeNode(NodeId id, bool& update_connection_time) = 0;
472+
473+
protected:
474+
/**
475+
* Protected destructor so that instances can only be deleted by derived classes.
476+
* If that restriction is no longer desired, this should be made public and virtual.
477+
*/
478+
~NetEventsInterface() = default;
472479
};
473480

474481
enum

src/net_processing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static constexpr int64_t EXTRA_PEER_CHECK_INTERVAL = 45;
3535
/** Minimum time an outbound-peer-eviction candidate must be connected for, in order to evict, in seconds */
3636
static constexpr int64_t MINIMUM_CONNECT_TIME = 30;
3737

38-
class PeerLogicValidation : public CValidationInterface, public NetEventsInterface {
38+
class PeerLogicValidation final : public CValidationInterface, public NetEventsInterface {
3939
private:
4040
CConnman* const connman;
4141

src/validationinterface.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ void SyncWithValidationInterfaceQueue();
5555

5656
class CValidationInterface {
5757
protected:
58+
/**
59+
* Protected destructor so that instances can only be deleted by derived classes.
60+
* If that restriction is no longer desired, this should be made public and virtual.
61+
*/
62+
~CValidationInterface() = default;
5863
/**
5964
* Notifies listeners of updated block chain tip
6065
*

0 commit comments

Comments
 (0)