From 85efb85acfa098998c0f1249320f7e08288efdfc Mon Sep 17 00:00:00 2001
From: Alexander Gavriliuk <alexandrgproductengine@lindenlab.com>
Date: Wed, 23 Aug 2023 11:06:53 +0200
Subject: SL-19299 Viewer crashes after change 'Pick a physics model:' dropdown

---
 indra/llcommon/llrefcount.h | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

(limited to 'indra/llcommon/llrefcount.h')

diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h
index 2080da1565..2281bf87da 100644
--- a/indra/llcommon/llrefcount.h
+++ b/indra/llcommon/llrefcount.h
@@ -51,21 +51,17 @@ protected:
 public:
 	LLRefCount();
 
-    inline void validateRefCount() const
-    {
-        llassert(mRef > 0); // ref count below 0, likely corrupted
-        llassert(mRef < gMaxRefCount); // ref count excessive, likely memory leak
-    }
-
 	inline void ref() const
 	{ 
+		llassert(mRef != LL_REFCOUNT_FREE); // object is deleted
 		mRef++; 
-        validateRefCount();
+		llassert(mRef < gMaxRefCount); // ref count excessive, likely memory leak
 	} 
 
 	inline S32 unref() const
 	{
-        validateRefCount();
+		llassert(mRef != LL_REFCOUNT_FREE); // object is deleted
+		llassert(mRef > 0); // ref count below 1, likely corrupted
 		if (0 == --mRef)
 		{
             mRef = LL_REFCOUNT_FREE; // set to nonsense yet recognizable value to aid in debugging
-- 
cgit v1.2.3


From beb6181863bbce18ff7f408014e02a1086bc9711 Mon Sep 17 00:00:00 2001
From: Alexander Gavriliuk <alexandrgproductengine@lindenlab.com>
Date: Wed, 23 Aug 2023 07:13:43 +0200
Subject: SL-19299 Code formatting in modified files

---
 indra/llcommon/llrefcount.h | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

(limited to 'indra/llcommon/llrefcount.h')

diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h
index 2281bf87da..15e7175fc8 100644
--- a/indra/llcommon/llrefcount.h
+++ b/indra/llcommon/llrefcount.h
@@ -52,11 +52,11 @@ public:
 	LLRefCount();
 
 	inline void ref() const
-	{ 
+	{
 		llassert(mRef != LL_REFCOUNT_FREE); // object is deleted
-		mRef++; 
+		mRef++;
 		llassert(mRef < gMaxRefCount); // ref count excessive, likely memory leak
-	} 
+	}
 
 	inline S32 unref() const
 	{
@@ -64,7 +64,7 @@ public:
 		llassert(mRef > 0); // ref count below 1, likely corrupted
 		if (0 == --mRef)
 		{
-            mRef = LL_REFCOUNT_FREE; // set to nonsense yet recognizable value to aid in debugging
+			mRef = LL_REFCOUNT_FREE; // set to nonsense yet recognizable value to aid in debugging
 			delete this;
 			return 0;
 		}
@@ -78,8 +78,8 @@ public:
 		return mRef;
 	}
 
-private: 
-	mutable S32	mRef; 
+private:
+	mutable S32	mRef;
 };
 
 
@@ -102,7 +102,7 @@ protected:
 public:
 	LLThreadSafeRefCount();
 	LLThreadSafeRefCount(const LLThreadSafeRefCount&);
-	LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref) 
+	LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref)
 	{
 		mRef = 0;
 		return *this;
@@ -110,8 +110,8 @@ public:
 
 	void ref()
 	{
-		mRef++; 
-	} 
+		mRef++;
+	}
 
 	void unref()
 	{
@@ -132,36 +132,36 @@ public:
 		return currentVal;
 	}
 
-private: 
-	LLAtomicS32 mRef; 
+private:
+	LLAtomicS32 mRef;
 };
 
 /**
  * intrusive pointer support for LLThreadSafeRefCount
  * this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type
  */
-inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p) 
+inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p)
 {
 	p->ref();
 }
 
-inline void intrusive_ptr_release(LLThreadSafeRefCount* p) 
+inline void intrusive_ptr_release(LLThreadSafeRefCount* p)
 {
-	p->unref(); 
+	p->unref();
 }
 
 /**
  * intrusive pointer support
  * this allows you to use boost::intrusive_ptr with any LLRefCount-derived type
  */
-inline void intrusive_ptr_add_ref(LLRefCount* p) 
+inline void intrusive_ptr_add_ref(LLRefCount* p)
 {
 	p->ref();
 }
 
-inline void intrusive_ptr_release(LLRefCount* p) 
+inline void intrusive_ptr_release(LLRefCount* p)
 {
-	p->unref(); 
+	p->unref();
 }
 
 #endif
-- 
cgit v1.2.3