From 75c0598caccfed9f505ebd6c6e13f5dad9470bcc 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 ad52ab4d..edfe4ada 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -678,6 +678,22 @@ public: 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; };