From 85efb85acfa098998c0f1249320f7e08288efdfc Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 23 Aug 2023 11:06:53 +0200 Subject: SL-19299 Viewer crashes after change 'Pick a physics model:' dropdown --- indra/llcommon/llpointer.h | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'indra/llcommon/llpointer.h') diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 9a6453ea48..2401951465 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -129,16 +129,6 @@ protected: void ref(); void unref(); #else - - void assign(const LLPointer& ptr) - { - if( mPointer != ptr.mPointer ) - { - unref(); - mPointer = ptr.mPointer; - ref(); - } - } void ref() { if (mPointer) @@ -161,7 +151,18 @@ protected: } } } -#endif +#endif // LL_LIBRARY_INCLUDE + + void assign(const LLPointer& ptr) + { + if (mPointer != ptr.mPointer) + { + unref(); + mPointer = ptr.mPointer; + ref(); + } + } + protected: Type* mPointer; }; @@ -264,7 +265,7 @@ protected: #ifdef LL_LIBRARY_INCLUDE void ref(); void unref(); -#else +#else // LL_LIBRARY_INCLUDE void ref() { if (mPointer) @@ -277,9 +278,9 @@ protected: { if (mPointer) { - const Type *tempp = mPointer; + const Type *temp = mPointer; mPointer = NULL; - tempp->unref(); + temp->unref(); if (mPointer != NULL) { LL_WARNS() << "Unreference did assignment to non-NULL because of destructor" << LL_ENDL; @@ -287,7 +288,7 @@ protected: } } } -#endif +#endif // LL_LIBRARY_INCLUDE protected: const Type* mPointer; }; -- cgit v1.2.3 From beb6181863bbce18ff7f408014e02a1086bc9711 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 23 Aug 2023 07:13:43 +0200 Subject: SL-19299 Code formatting in modified files --- indra/llcommon/llpointer.h | 114 ++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 57 deletions(-) (limited to 'indra/llcommon/llpointer.h') diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 2401951465..96ccfb481e 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -46,33 +46,32 @@ template class LLPointer { public: - - LLPointer() : + LLPointer() : mPointer(NULL) { } - LLPointer(Type* ptr) : + LLPointer(Type* ptr) : mPointer(ptr) { ref(); } - LLPointer(const LLPointer& ptr) : + LLPointer(const LLPointer& ptr) : mPointer(ptr.mPointer) { ref(); } - // support conversion up the type hierarchy. See Item 45 in Effective C++, 3rd Ed. + // Support conversion up the type hierarchy. See Item 45 in Effective C++, 3rd Ed. template - LLPointer(const LLPointer& ptr) : + LLPointer(const LLPointer& ptr) : mPointer(ptr.get()) { ref(); } - ~LLPointer() + ~LLPointer() { unref(); } @@ -83,39 +82,39 @@ public: const Type& operator*() const { return *mPointer; } Type& operator*() { return *mPointer; } - operator BOOL() const { return (mPointer != NULL); } - operator bool() const { return (mPointer != NULL); } + operator BOOL() const { return (mPointer != NULL); } + operator bool() const { return (mPointer != NULL); } bool operator!() const { return (mPointer == NULL); } bool isNull() const { return (mPointer == NULL); } bool notNull() const { return (mPointer != NULL); } - operator Type*() const { return mPointer; } - bool operator !=(Type* ptr) const { return (mPointer != ptr); } - bool operator ==(Type* ptr) const { return (mPointer == ptr); } - bool operator ==(const LLPointer& ptr) const { return (mPointer == ptr.mPointer); } - bool operator < (const LLPointer& ptr) const { return (mPointer < ptr.mPointer); } - bool operator > (const LLPointer& ptr) const { return (mPointer > ptr.mPointer); } + operator Type*() const { return mPointer; } + bool operator !=(Type* ptr) const { return (mPointer != ptr); } + bool operator ==(Type* ptr) const { return (mPointer == ptr); } + bool operator ==(const LLPointer& ptr) const { return (mPointer == ptr.mPointer); } + bool operator < (const LLPointer& ptr) const { return (mPointer < ptr.mPointer); } + bool operator > (const LLPointer& ptr) const { return (mPointer > ptr.mPointer); } - LLPointer& operator =(Type* ptr) - { + LLPointer& operator =(Type* ptr) + { assign(ptr); - return *this; + return *this; } - LLPointer& operator =(const LLPointer& ptr) - { + LLPointer& operator =(const LLPointer& ptr) + { assign(ptr); - return *this; + return *this; } // support assignment up the type hierarchy. See Item 45 in Effective C++, 3rd Ed. template - LLPointer& operator =(const LLPointer& ptr) - { + LLPointer& operator =(const LLPointer& ptr) + { assign(ptr.get()); - return *this; + return *this; } - + // Just exchange the pointers, which will not change the reference counts. static void swap(LLPointer& a, LLPointer& b) { @@ -170,18 +169,18 @@ protected: template class LLConstPointer { public: - LLConstPointer() : + LLConstPointer() : mPointer(NULL) { } - LLConstPointer(const Type* ptr) : + LLConstPointer(const Type* ptr) : mPointer(ptr) { ref(); } - LLConstPointer(const LLConstPointer& ptr) : + LLConstPointer(const LLConstPointer& ptr) : mPointer(ptr.mPointer) { ref(); @@ -189,7 +188,7 @@ public: // support conversion up the type hierarchy. See Item 45 in Effective C++, 3rd Ed. template - LLConstPointer(const LLConstPointer& ptr) : + LLConstPointer(const LLConstPointer& ptr) : mPointer(ptr.get()) { ref(); @@ -204,55 +203,55 @@ public: const Type* operator->() const { return mPointer; } const Type& operator*() const { return *mPointer; } - operator BOOL() const { return (mPointer != NULL); } - operator bool() const { return (mPointer != NULL); } + operator BOOL() const { return (mPointer != NULL); } + operator bool() const { return (mPointer != NULL); } bool operator!() const { return (mPointer == NULL); } bool isNull() const { return (mPointer == NULL); } bool notNull() const { return (mPointer != NULL); } - operator const Type*() const { return mPointer; } - bool operator !=(const Type* ptr) const { return (mPointer != ptr); } - bool operator ==(const Type* ptr) const { return (mPointer == ptr); } - bool operator ==(const LLConstPointer& ptr) const { return (mPointer == ptr.mPointer); } - bool operator < (const LLConstPointer& ptr) const { return (mPointer < ptr.mPointer); } - bool operator > (const LLConstPointer& ptr) const { return (mPointer > ptr.mPointer); } + operator const Type*() const { return mPointer; } + bool operator !=(const Type* ptr) const { return (mPointer != ptr); } + bool operator ==(const Type* ptr) const { return (mPointer == ptr); } + bool operator ==(const LLConstPointer& ptr) const { return (mPointer == ptr.mPointer); } + bool operator < (const LLConstPointer& ptr) const { return (mPointer < ptr.mPointer); } + bool operator > (const LLConstPointer& ptr) const { return (mPointer > ptr.mPointer); } - LLConstPointer& operator =(const Type* ptr) + LLConstPointer& operator =(const Type* ptr) { if( mPointer != ptr ) { - unref(); - mPointer = ptr; + unref(); + mPointer = ptr; ref(); } - return *this; + return *this; } - LLConstPointer& operator =(const LLConstPointer& ptr) - { + LLConstPointer& operator =(const LLConstPointer& ptr) + { if( mPointer != ptr.mPointer ) { - unref(); + unref(); mPointer = ptr.mPointer; ref(); } - return *this; + return *this; } // support assignment up the type hierarchy. See Item 45 in Effective C++, 3rd Ed. template - LLConstPointer& operator =(const LLConstPointer& ptr) - { + LLConstPointer& operator =(const LLConstPointer& ptr) + { if( mPointer != ptr.get() ) { - unref(); + unref(); mPointer = ptr.get(); ref(); } - return *this; + return *this; } - + // Just exchange the pointers, which will not change the reference counts. static void swap(LLConstPointer& a, LLConstPointer& b) { @@ -263,11 +262,11 @@ public: protected: #ifdef LL_LIBRARY_INCLUDE - void ref(); + void ref(); void unref(); #else // LL_LIBRARY_INCLUDE - void ref() - { + void ref() + { if (mPointer) { mPointer->ref(); @@ -289,6 +288,7 @@ protected: } } #endif // LL_LIBRARY_INCLUDE + protected: const Type* mPointer; }; @@ -298,13 +298,13 @@ class LLCopyOnWritePointer : public LLPointer { public: typedef LLCopyOnWritePointer self_t; - typedef LLPointer pointer_t; - - LLCopyOnWritePointer() + typedef LLPointer pointer_t; + + LLCopyOnWritePointer() : mStayUnique(false) {} - LLCopyOnWritePointer(Type* ptr) + LLCopyOnWritePointer(Type* ptr) : LLPointer(ptr), mStayUnique(false) {} -- cgit v1.2.3