summaryrefslogtreecommitdiff
path: root/stoc/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2010-10-12 13:56:53 +0100
committerCaolán McNamara <caolanm@redhat.com>2010-10-12 13:56:53 +0100
commitfefa4fae4fb423a069c11c7c039c6f5a482ea964 (patch)
tree81f9d2c0356255d79532af0be358089eeb1106d6 /stoc/source
parent394c48219a9126748352d11cc545325d0c28603a (diff)
move some uno::Sequences to ensure a safer deterministic shutdown order
Diffstat (limited to 'stoc/source')
-rw-r--r--stoc/source/security/access_controller.cxx22
-rw-r--r--stoc/source/security/file_policy.cxx26
2 files changed, 24 insertions, 24 deletions
diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx
index c3a4d882c..d259232ae 100644
--- a/stoc/source/security/access_controller.cxx
+++ b/stoc/source/security/access_controller.cxx
@@ -57,6 +57,8 @@
#include "lru_cache.h"
#include "permissions.h"
+#include "bootstrapservices.hxx"
+
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
#define SERVICE_NAME "com.sun.star.security.AccessController"
@@ -79,12 +81,8 @@ namespace stoc_sec
{
// static stuff initialized when loading lib
static OUString s_envType = OUSTR(CPPU_CURRENT_LANGUAGE_BINDING_NAME);
-static OUString s_implName = OUSTR(IMPL_NAME);
-static OUString s_serviceName = OUSTR(SERVICE_NAME);
static OUString s_acRestriction = OUSTR("access-control.restriction");
-static Sequence< OUString > s_serviceNames = Sequence< OUString >( &s_serviceName, 1 );
-
//##################################################################################################
/** ac context intersects permissions of two ac contexts
@@ -1008,14 +1006,15 @@ Reference< security::XAccessControlContext > AccessController::getContext()
OUString AccessController::getImplementationName()
throw (RuntimeException)
{
- return s_implName;
+ return stoc_bootstrap::ac_getImplementationName();
}
//__________________________________________________________________________________________________
sal_Bool AccessController::supportsService( OUString const & serviceName )
throw (RuntimeException)
{
- OUString const * pNames = s_serviceNames.getConstArray();
- for ( sal_Int32 nPos = s_serviceNames.getLength(); nPos--; )
+ Sequence< OUString > aSNL = getSupportedServiceNames();
+ const OUString * pNames = aSNL.getConstArray();
+ for ( sal_Int32 nPos = aSNL.getLength(); --nPos; )
{
if (serviceName.equals( pNames[ nPos ] ))
{
@@ -1028,7 +1027,7 @@ sal_Bool AccessController::supportsService( OUString const & serviceName )
Sequence< OUString > AccessController::getSupportedServiceNames()
throw (RuntimeException)
{
- return s_serviceNames;
+ return stoc_bootstrap::ac_getSupportedServiceNames();
}
}
//##################################################################################################
@@ -1043,12 +1042,15 @@ Reference< XInterface > SAL_CALL ac_create(
//--------------------------------------------------------------------------------------------------
Sequence< OUString > ac_getSupportedServiceNames() SAL_THROW( () )
{
- return stoc_sec::s_serviceNames;
+ static OUString s_serviceName = OUSTR(SERVICE_NAME);
+ static Sequence< OUString > s_serviceNames = Sequence< OUString >( &s_serviceName, 1 );
+ return s_serviceNames;
}
//--------------------------------------------------------------------------------------------------
OUString ac_getImplementationName() SAL_THROW( () )
{
- return stoc_sec::s_implName;
+ static OUString s_implName = OUSTR(IMPL_NAME);
+ return s_implName;
}
//--------------------------------------------------------------------------------------------------
Reference< XInterface > SAL_CALL filepolicy_create(
diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx
index 747d9dc0d..975ff669e 100644
--- a/stoc/source/security/file_policy.cxx
+++ b/stoc/source/security/file_policy.cxx
@@ -48,11 +48,12 @@
#include <com/sun/star/io/FilePermission.hpp>
#include <com/sun/star/connection/SocketPermission.hpp>
+#include "bootstrapservices.hxx"
+
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
#define SERVICE_NAME "com.sun.star.security.Policy"
#define IMPL_NAME "com.sun.star.security.comp.stoc.FilePolicy"
-
using namespace ::osl;
using namespace ::rtl;
using namespace ::cppu;
@@ -63,13 +64,6 @@ extern ::rtl_StandardModuleCount g_moduleCount;
namespace stoc_sec
{
-// static stuff initialized when loading lib
-static OUString s_implName = OUSTR(IMPL_NAME);
-static OUString s_serviceName = OUSTR(SERVICE_NAME);
-
-static Sequence< OUString > s_serviceNames = Sequence< OUString >( &s_serviceName, 1 );
-//##################################################################################################
-
//--------------------------------------------------------------------------------------------------
static inline void dispose( Reference< XInterface > const & x )
SAL_THROW( (RuntimeException) )
@@ -558,14 +552,15 @@ void FilePolicy::refresh()
OUString FilePolicy::getImplementationName()
throw (RuntimeException)
{
- return s_implName;
+ return stoc_bootstrap::filepolicy_getImplementationName();
}
//__________________________________________________________________________________________________
sal_Bool FilePolicy::supportsService( OUString const & serviceName )
throw (RuntimeException)
{
- OUString const * pNames = s_serviceNames.getConstArray();
- for ( sal_Int32 nPos = s_serviceNames.getLength(); nPos--; )
+ Sequence< OUString > aSNL = getSupportedServiceNames();
+ const OUString * pNames = aSNL.getConstArray();
+ for ( sal_Int32 nPos = aSNL.getLength(); --nPos; )
{
if (serviceName.equals( pNames[ nPos ] ))
{
@@ -578,7 +573,7 @@ sal_Bool FilePolicy::supportsService( OUString const & serviceName )
Sequence< OUString > FilePolicy::getSupportedServiceNames()
throw (RuntimeException)
{
- return s_serviceNames;
+ return stoc_bootstrap::filepolicy_getSupportedServiceNames();
}
}
//##################################################################################################
@@ -594,11 +589,14 @@ Reference< XInterface > SAL_CALL filepolicy_create(
//--------------------------------------------------------------------------------------------------
Sequence< OUString > filepolicy_getSupportedServiceNames() SAL_THROW( () )
{
- return stoc_sec::s_serviceNames;
+ static OUString s_serviceName = OUSTR(SERVICE_NAME);
+ static Sequence< OUString > s_serviceNames = Sequence< OUString >( &s_serviceName, 1 );
+ return s_serviceNames;
}
//--------------------------------------------------------------------------------------------------
OUString filepolicy_getImplementationName() SAL_THROW( () )
{
- return stoc_sec::s_implName;
+ static OUString s_implName = OUSTR(IMPL_NAME);
+ return s_implName;
}
}