diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-04-01 21:25:49 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-04-02 14:53:48 +0100 |
commit | 09bdea8900c5ce79df3e8f2b7fbeeed06a5b4111 (patch) | |
tree | bf8ccafec8f39df52a0b1c595e7c8a355630ac04 /svx | |
parent | 15f14ec79477142cf2bcb1484511b7bea6f1485b (diff) |
remove static objects from static_initialization_and_destruction chain
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/svx/dbtoolsclient.hxx | 1 | ||||
-rw-r--r-- | svx/source/form/dbtoolsclient.cxx | 12 |
2 files changed, 9 insertions, 4 deletions
diff --git a/svx/inc/svx/dbtoolsclient.hxx b/svx/inc/svx/dbtoolsclient.hxx index 8c86223e20d7..661f8d8ad2c3 100644 --- a/svx/inc/svx/dbtoolsclient.hxx +++ b/svx/inc/svx/dbtoolsclient.hxx @@ -52,7 +52,6 @@ namespace svxform class SVX_DLLPUBLIC ODbtoolsClient { private: - static ::osl::Mutex s_aMutex; static sal_Int32 s_nClients; static oslModule s_hDbtoolsModule; static ::connectivity::simple::createDataAccessToolsFactoryFunction diff --git a/svx/source/form/dbtoolsclient.cxx b/svx/source/form/dbtoolsclient.cxx index e71025c9aa0d..78c04445c70f 100644 --- a/svx/source/form/dbtoolsclient.cxx +++ b/svx/source/form/dbtoolsclient.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/sdb/SQLContext.hpp> #include "svx/dbtoolsclient.hxx" #include <osl/diagnose.h> +#include <rtl/instance.hxx> #include <connectivity/formattedcolumnvalue.hxx> //........................................................................ @@ -51,7 +52,12 @@ namespace svxform //==================================================================== //= ODbtoolsClient //==================================================================== - ::osl::Mutex ODbtoolsClient::s_aMutex; + + namespace + { + struct theODbtoolsClientMutex : public rtl::Static< osl::Mutex, theODbtoolsClientMutex> {}; + } + sal_Int32 ODbtoolsClient::s_nClients = 0; oslModule ODbtoolsClient::s_hDbtoolsModule = NULL; createDataAccessToolsFactoryFunction @@ -103,7 +109,7 @@ namespace svxform void ODbtoolsClient::registerClient() { - ::osl::MutexGuard aGuard(s_aMutex); + ::osl::MutexGuard aGuard(theODbtoolsClientMutex::get()); if (1 == ++s_nClients) { OSL_ENSURE(NULL == s_hDbtoolsModule, "ODbtoolsClient::registerClient: inconsistence: already have a module!"); @@ -138,7 +144,7 @@ namespace svxform //-------------------------------------------------------------------- void ODbtoolsClient::revokeClient() { - ::osl::MutexGuard aGuard(s_aMutex); + ::osl::MutexGuard aGuard(theODbtoolsClientMutex::get()); if (0 == --s_nClients) { s_pFactoryCreationFunc = NULL; |