X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/d6f6602d7cea3a7899990fe79216af7d98d05917..3bad22d5566624804a73b3791980bab2d84c8266:/lib/base/smartptr.h diff --git a/lib/base/smartptr.h b/lib/base/smartptr.h index 85ad5a90..aafecf0e 100644 --- a/lib/base/smartptr.h +++ b/lib/base/smartptr.h @@ -43,21 +43,21 @@ public: } ePtr &operator=(T *c) { + if (c) + c->AddRef(); if (ptr) ptr->Release(); ptr=c; - if (ptr) - ptr->AddRef(); return *this; } ePtr &operator=(ePtr &c) { + if (c.ptr) + c.ptr->AddRef(); if (ptr) ptr->Release(); ptr=c.ptr; - if (ptr) - ptr->AddRef(); return *this; }