File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -777,15 +777,24 @@ static list<CNode*> vNodesDisconnected;
777
777
778
778
class CNodeRef {
779
779
public:
780
- CNodeRef (CNode *pnode) : _pnode(pnode) {_pnode->AddRef ();}
781
- ~CNodeRef () {_pnode->Release ();}
780
+ CNodeRef (CNode *pnode) : _pnode(pnode) {
781
+ LOCK (cs_vNodes);
782
+ _pnode->AddRef ();
783
+ }
784
+
785
+ ~CNodeRef () {
786
+ LOCK (cs_vNodes);
787
+ _pnode->Release ();
788
+ }
782
789
783
790
CNode& operator *() const {return *_pnode;};
784
791
CNode* operator ->() const {return _pnode;};
785
792
786
793
CNodeRef& operator =(const CNodeRef& other)
787
794
{
788
795
if (this != &other) {
796
+ LOCK (cs_vNodes);
797
+
789
798
_pnode->Release ();
790
799
_pnode = other._pnode ;
791
800
_pnode->AddRef ();
@@ -796,6 +805,7 @@ class CNodeRef {
796
805
CNodeRef (const CNodeRef& other):
797
806
_pnode (other._pnode)
798
807
{
808
+ LOCK (cs_vNodes);
799
809
_pnode->AddRef ();
800
810
}
801
811
private:
You can’t perform that action at this time.
0 commit comments