MAINT-5232: Clean up some dubious LLSingleton methods.
Remove evil getIfExists() method, used by no one. Remove evil destroyed() method, used in exactly three places -- one of which is a test. Replace with equally evil instanceExists() method, which is used EVERYWHERE -- sigh.meow-7.2.2
parent
107b9bcb70
commit
331e932857
|
|
@ -269,7 +269,7 @@ public:
|
|||
|
||||
~ScopedRegistrar()
|
||||
{
|
||||
if (!singleton_t::destroyed())
|
||||
if (singleton_t::instanceExists())
|
||||
{
|
||||
popScope();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,31 +166,19 @@ public:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static DERIVED_TYPE* getIfExists()
|
||||
{
|
||||
return sData.mInstance;
|
||||
}
|
||||
|
||||
// Reference version of getInstance()
|
||||
// Preferred over getInstance() as it disallows checking for NULL
|
||||
static DERIVED_TYPE& instance()
|
||||
{
|
||||
return *getInstance();
|
||||
}
|
||||
|
||||
// Has this singleton been created uet?
|
||||
// Use this to avoid accessing singletons before the can safely be constructed
|
||||
|
||||
// Has this singleton been created yet?
|
||||
// Use this to avoid accessing singletons before they can safely be constructed.
|
||||
static bool instanceExists()
|
||||
{
|
||||
return sData.mInitState == INITIALIZED;
|
||||
}
|
||||
|
||||
// Has this singleton already been deleted?
|
||||
// Use this to avoid accessing singletons from a static object's destructor
|
||||
static bool destroyed()
|
||||
{
|
||||
return sData.mInitState == DELETED;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ namespace tut
|
|||
|
||||
//Delete the instance
|
||||
LLSingletonTest::deleteSingleton();
|
||||
ensure(LLSingletonTest::destroyed());
|
||||
ensure(!LLSingletonTest::instanceExists());
|
||||
|
||||
//Construct it again.
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ LLFloaterIMContainer::~LLFloaterIMContainer()
|
|||
gSavedPerAccountSettings.setBOOL("ConversationsMessagePaneCollapsed", mMessagesPane->isCollapsed());
|
||||
gSavedPerAccountSettings.setBOOL("ConversationsParticipantListCollapsed", !isParticipantListExpanded());
|
||||
|
||||
if (!LLSingleton<LLIMMgr>::destroyed())
|
||||
if (LLIMMgr::instanceExists())
|
||||
{
|
||||
LLIMMgr::getInstance()->removeSessionObserver(this);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue