diff options
author | Matúš Kukan <matus.kukan@gmail.com> | 2012-07-26 11:55:39 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@gmail.com> | 2012-07-26 15:59:19 +0200 |
commit | bb9399e2cf0072d1de7cb0aea162d107ebde4360 (patch) | |
tree | 217696157c18ed2a291845191cc60e2b39bbf9d8 /tubes/source | |
parent | c55b2d0b32dd210c2a809ce2b5ebca12bfb5b1d8 (diff) |
tubes: kill double-singletonning of TeleManager
I am not sure why it was introduced in
0dae49a03c9b4816d8cdde69e30bcd2db2e30724
and hope that it's safe to remove it now.
Change-Id: I62f0ac230a83473386eabc45c9fcc387f62631e3
Diffstat (limited to 'tubes/source')
-rw-r--r-- | tubes/source/manager.cxx | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index c60388ffd296..cfff455951c2 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -81,10 +81,6 @@ TeleManagerImpl* TeleManager::pImpl = NULL; sal_uInt32 TeleManager::nRefCount = 0; rtl::OString TeleManager::aNameSuffix; -sal_uInt32 TeleManager::nAnotherRefCount = 0; -TeleManager* TeleManager::pSingleton = NULL; - - /** Refcounted singleton implementation class. */ class TeleManagerImpl { @@ -390,6 +386,7 @@ TeleManager::TeleManager() : mbChannelReadyHandlerInvoked( false) { + SAL_INFO( "tubes", "TeleManager::get: count: " << nRefCount ); // The glib object types need to be initialized, else we aren't going // anywhere. g_type_init(); @@ -400,7 +397,6 @@ TeleManager::TeleManager() pImpl = new TeleManagerImpl; } - TeleManager::~TeleManager() { MutexGuard aGuard( GetMutex()); @@ -411,29 +407,7 @@ TeleManager::~TeleManager() delete pImpl; pImpl = NULL; } -} - -TeleManager * -TeleManager::get() -{ - MutexGuard aGuard( GetAnotherMutex()); - SAL_INFO( "tubes", "TeleManager::get: count: " << nAnotherRefCount ); - if (!pSingleton) - pSingleton = new TeleManager(); - - nAnotherRefCount++; - return pSingleton; -} - -void -TeleManager::unref() -{ - MutexGuard aGuard( GetAnotherMutex()); - if (nAnotherRefCount && --nAnotherRefCount == 0) { - delete pSingleton; - pSingleton = NULL; - } - SAL_INFO( "tubes", "TeleManager::unref: count: " << nAnotherRefCount ); + SAL_INFO( "tubes", "TeleManager::unref: count: " << nRefCount ); } bool TeleManager::init( bool bListen ) @@ -913,19 +887,6 @@ Mutex& TeleManager::GetMutex() return *pMutex; } -Mutex& TeleManager::GetAnotherMutex() -{ - static Mutex* pMutex = NULL; - if (!pMutex) - { - MutexGuard aGuard( Mutex::getGlobalMutex()); - if (!pMutex) - pMutex = new Mutex; - } - return *pMutex; -} - - // static void TeleManager::addSuffixToNames( const char* pName ) { |