From 69ee1aab00b9189865dfca6fb5c33c61a3c3ea67 Mon Sep 17 00:00:00 2001 From: Patrick Strateman Date: Tue, 25 Aug 2015 15:33:29 -0700 Subject: [PATCH] CNodeRef copy constructor and assignment operator --- src/net.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/net.cpp b/src/net.cpp index 4f4c7b81c4e44..cb5a24f0a4ce6 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -782,6 +782,22 @@ class CNodeRef { CNode& operator *() const {return *_pnode;}; CNode* operator ->() const {return _pnode;}; + + CNodeRef& operator =(const CNodeRef& other) + { + if (this != &other) { + _pnode->Release(); + _pnode = other._pnode; + _pnode->AddRef(); + } + return *this; + } + + CNodeRef(const CNodeRef& other): + _pnode(other._pnode) + { + _pnode->AddRef(); + } private: CNode *_pnode; };