From 41e5bf346eaa0a43646058691cc8090ddfe498e9 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Mon, 29 Apr 2013 10:58:37 -0700
Subject: [PATCH] SH-4080 WIP interesting: random crash on Mac fixed singleton
 unit test resurrecting a singleton now properly calls initSingleton()

---
 indra/llcommon/llsingleton.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h
index 7558bf4fae8..40002313f18 100644
--- a/indra/llcommon/llsingleton.h
+++ b/indra/llcommon/llsingleton.h
@@ -136,21 +136,22 @@ class LLSingleton : private boost::noncopyable
 		case UNINITIALIZED:
 			// should never be uninitialized at this point
 			llassert(false);
-			break;
+			return NULL;
 		case CONSTRUCTING:
 			llerrs << "Tried to access singleton " << typeid(DERIVED_TYPE).name() << " from singleton constructor!" << llendl;
-			break;
+			return NULL;
 		case INITIALIZING:
 			// go ahead and flag ourselves as initialized so we can be reentrant during initialization
 			sData.mInitState = INITIALIZED;	
 			sData.mInstance->initSingleton(); 
 			return sData.mInstance;
-			break;
 		case INITIALIZED:
 			return sData.mInstance;
 		case DELETED:
 			llwarns << "Trying to access deleted singleton " << typeid(DERIVED_TYPE).name() << " creating new instance" << llendl;
 			SingletonLifetimeManager::construct();
+			sData.mInitState = INITIALIZED;	
+			sData.mInstance->initSingleton(); 
 			return sData.mInstance;
 		}
 
-- 
GitLab