From 7aa827f714d8c605f94565d2542569b1916bbd19 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 ae81ea5449fc5..32503cb18f6fc 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -896,6 +896,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; };