diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-10-12 13:56:53 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-10-12 13:56:53 +0100 |
commit | 68d23b4842c481d46ce226727bb6a459f940e98a (patch) | |
tree | 60c0025484fa254c2e9544a071274e214792d234 /stoc | |
parent | #i112784# do not leak ContextAdmin (diff) | |
download | core-68d23b4842c481d46ce226727bb6a459f940e98a.tar.gz core-68d23b4842c481d46ce226727bb6a459f940e98a.zip |
move some uno::Sequences to ensure a safer deterministic shutdown order
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/security/access_controller.cxx | 22 | ||||
-rw-r--r-- | stoc/source/security/file_policy.cxx | 26 |
2 files changed, 24 insertions, 24 deletions
diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx index c7b1779a5a87..3789aa7a79e0 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 e9eb46ac6344..a1ec734445b7 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; } } |