boost::scoped_ptr is sufficient here
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
#include <comphelper/ChainablePropertySetInfo.hxx>
|
#include <comphelper/ChainablePropertySetInfo.hxx>
|
||||||
#include <osl/mutex.hxx>
|
#include <osl/mutex.hxx>
|
||||||
|
|
||||||
#include <memory> // STL auto_ptr
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
|
|
||||||
using namespace ::rtl;
|
using namespace ::rtl;
|
||||||
@@ -78,7 +78,7 @@ void SAL_CALL ChainablePropertySet::setPropertyValue( const ::rtl::OUString& rPr
|
|||||||
throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
|
throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
|
||||||
{
|
{
|
||||||
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
||||||
std::auto_ptr< osl::SolarGuard > pMutexGuard;
|
boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
|
||||||
if (mpMutex)
|
if (mpMutex)
|
||||||
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ Any SAL_CALL ChainablePropertySet::getPropertyValue( const ::rtl::OUString& rPro
|
|||||||
throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
|
throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
|
||||||
{
|
{
|
||||||
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
||||||
std::auto_ptr< osl::SolarGuard > pMutexGuard;
|
boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
|
||||||
if (mpMutex)
|
if (mpMutex)
|
||||||
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ void SAL_CALL ChainablePropertySet::setPropertyValues( const Sequence< ::rtl::OU
|
|||||||
throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
|
throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
|
||||||
{
|
{
|
||||||
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
||||||
std::auto_ptr< osl::SolarGuard > pMutexGuard;
|
boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
|
||||||
if (mpMutex)
|
if (mpMutex)
|
||||||
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ Sequence< Any > SAL_CALL ChainablePropertySet::getPropertyValues( const Sequence
|
|||||||
throw(RuntimeException)
|
throw(RuntimeException)
|
||||||
{
|
{
|
||||||
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
||||||
std::auto_ptr< osl::SolarGuard > pMutexGuard;
|
boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
|
||||||
if (mpMutex)
|
if (mpMutex)
|
||||||
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
||||||
|
|
||||||
|
@@ -35,26 +35,26 @@
|
|||||||
#include <comphelper/ChainablePropertySetInfo.hxx>
|
#include <comphelper/ChainablePropertySetInfo.hxx>
|
||||||
#include <osl/mutex.hxx>
|
#include <osl/mutex.hxx>
|
||||||
|
|
||||||
#include <memory> // STL auto_ptr
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class AutoOGuardArray
|
class AutoOGuardArray
|
||||||
{
|
{
|
||||||
sal_Int32 nSize;
|
sal_Int32 nSize;
|
||||||
std::auto_ptr< osl::SolarGuard > * pGuardArray;
|
boost::scoped_ptr< osl::SolarGuard > * pGuardArray;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AutoOGuardArray( sal_Int32 nNumElements );
|
AutoOGuardArray( sal_Int32 nNumElements );
|
||||||
~AutoOGuardArray();
|
~AutoOGuardArray();
|
||||||
|
|
||||||
std::auto_ptr< osl::SolarGuard > & operator[] ( sal_Int32 i ) { return pGuardArray[i]; }
|
boost::scoped_ptr< osl::SolarGuard > & operator[] ( sal_Int32 i ) { return pGuardArray[i]; }
|
||||||
};
|
};
|
||||||
|
|
||||||
AutoOGuardArray::AutoOGuardArray( sal_Int32 nNumElements )
|
AutoOGuardArray::AutoOGuardArray( sal_Int32 nNumElements )
|
||||||
{
|
{
|
||||||
nSize = nNumElements;
|
nSize = nNumElements;
|
||||||
pGuardArray = new std::auto_ptr< osl::SolarGuard >[ nSize ];
|
pGuardArray = new boost::scoped_ptr< osl::SolarGuard >[ nSize ];
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoOGuardArray::~AutoOGuardArray()
|
AutoOGuardArray::~AutoOGuardArray()
|
||||||
@@ -130,7 +130,7 @@ void SAL_CALL MasterPropertySet::setPropertyValue( const ::rtl::OUString& rPrope
|
|||||||
throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
|
throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
|
||||||
{
|
{
|
||||||
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
||||||
std::auto_ptr< osl::SolarGuard > pMutexGuard;
|
boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
|
||||||
if (mpMutex)
|
if (mpMutex)
|
||||||
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ void SAL_CALL MasterPropertySet::setPropertyValue( const ::rtl::OUString& rPrope
|
|||||||
ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave;
|
ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave;
|
||||||
|
|
||||||
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
||||||
std::auto_ptr< osl::SolarGuard > pMutexGuard2;
|
boost::scoped_ptr< osl::SolarGuard > pMutexGuard2;
|
||||||
if (pSlave->mpMutex)
|
if (pSlave->mpMutex)
|
||||||
pMutexGuard2.reset( new osl::SolarGuard(pSlave->mpMutex) );
|
pMutexGuard2.reset( new osl::SolarGuard(pSlave->mpMutex) );
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ Any SAL_CALL MasterPropertySet::getPropertyValue( const ::rtl::OUString& rProper
|
|||||||
throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
|
throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
|
||||||
{
|
{
|
||||||
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
||||||
std::auto_ptr< osl::SolarGuard > pMutexGuard;
|
boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
|
||||||
if (mpMutex)
|
if (mpMutex)
|
||||||
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ Any SAL_CALL MasterPropertySet::getPropertyValue( const ::rtl::OUString& rProper
|
|||||||
ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave;
|
ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave;
|
||||||
|
|
||||||
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
||||||
std::auto_ptr< osl::SolarGuard > pMutexGuard2;
|
boost::scoped_ptr< osl::SolarGuard > pMutexGuard2;
|
||||||
if (pSlave->mpMutex)
|
if (pSlave->mpMutex)
|
||||||
pMutexGuard2.reset( new osl::SolarGuard(pSlave->mpMutex) );
|
pMutexGuard2.reset( new osl::SolarGuard(pSlave->mpMutex) );
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< ::rtl::OUStr
|
|||||||
throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
|
throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
|
||||||
{
|
{
|
||||||
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
||||||
std::auto_ptr< osl::SolarGuard > pMutexGuard;
|
boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
|
||||||
if (mpMutex)
|
if (mpMutex)
|
||||||
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ Sequence< Any > SAL_CALL MasterPropertySet::getPropertyValues( const Sequence< :
|
|||||||
throw(RuntimeException)
|
throw(RuntimeException)
|
||||||
{
|
{
|
||||||
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
||||||
std::auto_ptr< osl::SolarGuard > pMutexGuard;
|
boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
|
||||||
if (mpMutex)
|
if (mpMutex)
|
||||||
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
|
||||||
|
|
||||||
@@ -392,7 +392,7 @@ PropertyState SAL_CALL MasterPropertySet::getPropertyState( const ::rtl::OUStrin
|
|||||||
ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave;
|
ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave;
|
||||||
|
|
||||||
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
|
||||||
std::auto_ptr< osl::SolarGuard > pMutexGuard;
|
boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
|
||||||
if (pSlave->mpMutex)
|
if (pSlave->mpMutex)
|
||||||
pMutexGuard.reset( new osl::SolarGuard(pSlave->mpMutex) );
|
pMutexGuard.reset( new osl::SolarGuard(pSlave->mpMutex) );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user