diff options
author | richard <none@none> | 2010-01-22 17:40:28 -0800 |
---|---|---|
committer | richard <none@none> | 2010-01-22 17:40:28 -0800 |
commit | 947398563e8082fae2583d2749b69ad16611eae5 (patch) | |
tree | 61aab38a32e6822d96cc8efe094d41f89b378861 /indra/llcommon | |
parent | fa891c062ef66410123c66de1ef67b7dcef327db (diff) | |
parent | 955c0cc5a9ab8fb9eda7a6c20cd7bd09c2fd9369 (diff) |
merge
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llpointer.h | 1 | ||||
-rw-r--r-- | indra/llcommon/llrefcount.cpp | 11 | ||||
-rw-r--r-- | indra/llcommon/llrefcount.h | 14 |
3 files changed, 18 insertions, 8 deletions
diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 2c37eadcc6..e6c736a263 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -95,7 +95,6 @@ public: bool notNull() const { return (mPointer != NULL); } operator Type*() const { return mPointer; } - operator const Type*() const { return mPointer; } bool operator !=(Type* ptr) const { return (mPointer != ptr); } bool operator ==(Type* ptr) const { return (mPointer == ptr); } bool operator ==(const LLPointer<Type>& ptr) const { return (mPointer == ptr.mPointer); } diff --git a/indra/llcommon/llrefcount.cpp b/indra/llcommon/llrefcount.cpp index 33b6875fb0..c90b52f482 100644 --- a/indra/llcommon/llrefcount.cpp +++ b/indra/llcommon/llrefcount.cpp @@ -35,6 +35,17 @@ #include "llerror.h" +LLRefCount::LLRefCount(const LLRefCount& other) +: mRef(0) +{ +} + +LLRefCount& LLRefCount::operator=(const LLRefCount&) +{ + // do nothing, since ref count is specific to *this* reference + return *this; +} + LLRefCount::LLRefCount() : mRef(0) { diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h index 9ab844eb22..a18f6706a9 100644 --- a/indra/llcommon/llrefcount.h +++ b/indra/llcommon/llrefcount.h @@ -41,22 +41,20 @@ class LL_COMMON_API LLRefCount { -private: - LLRefCount(const LLRefCount& other); // no implementation -private: - LLRefCount& operator=(const LLRefCount&); // no implementation protected: + LLRefCount(const LLRefCount& other); + LLRefCount& operator=(const LLRefCount&); virtual ~LLRefCount(); // use unref() public: LLRefCount(); - void ref() + void ref() const { mRef++; } - S32 unref() + S32 unref() const { llassert(mRef >= 1); if (0 == --mRef) @@ -67,13 +65,15 @@ public: return mRef; } + //NOTE: when passing around a const LLRefCount object, this can return different results + // at different types, since mRef is mutable S32 getNumRefs() const { return mRef; } private: - S32 mRef; + mutable S32 mRef; }; #endif |