diff options
Diffstat (limited to 'libs/rs/rsObjectBase.h')
-rw-r--r-- | libs/rs/rsObjectBase.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/libs/rs/rsObjectBase.h b/libs/rs/rsObjectBase.h index ca7acda5a92d..4c52e9ccc4fe 100644 --- a/libs/rs/rsObjectBase.h +++ b/libs/rs/rsObjectBase.h @@ -33,7 +33,13 @@ public: void incRef() const; void decRef() const; + const char * getName() const { + return mName; + } + void setName(const char *); + private: + char * mName; mutable int32_t mRefCount; @@ -49,12 +55,16 @@ public: ObjectBaseRef(const ObjectBaseRef &ref) { mRef = ref.get(); - mRef->incRef(); + if (mRef) { + mRef->incRef(); + } } ObjectBaseRef(T *ref) { mRef = ref; - ref->incRef(); + if (mRef) { + ref->incRef(); + } } ~ObjectBaseRef() { @@ -65,10 +75,16 @@ public: if (mRef != ref) { clear(); mRef = ref; - ref->incRef(); + if (mRef) { + ref->incRef(); + } } } + void set(const ObjectBaseRef &ref) { + set(ref.mRef); + } + void clear() { if (mRef) { mRef->decRef(); |