diff options
Diffstat (limited to 'comphelper/source/property/MasterPropertySet.cxx')
-rw-r--r-- | comphelper/source/property/MasterPropertySet.cxx | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx index 82f9d85d7525..e5e94b5ad46f 100644 --- a/comphelper/source/property/MasterPropertySet.cxx +++ b/comphelper/source/property/MasterPropertySet.cxx @@ -189,53 +189,53 @@ void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< OUString >& if( nCount != aValues.getLength() ) throw IllegalArgumentException(); - if( nCount ) - { - _preSetValues(); + if( !nCount ) + return; - const Any * pAny = aValues.getConstArray(); - const OUString * pString = aPropertyNames.getConstArray(); - PropertyDataHash::const_iterator aEnd = mxInfo->maMap.end(), aIter; + _preSetValues(); - //!! have a unique_ptr to an array of OGuards in order to have the - //!! allocated memory properly freed (exception safe!). - //!! Since the array itself has unique_ptrs as members we have to use a - //!! helper class 'AutoOGuardArray' in order to have - //!! the acquired locks properly released. - AutoOGuardArray aOGuardArray( nCount ); + const Any * pAny = aValues.getConstArray(); + const OUString * pString = aPropertyNames.getConstArray(); + PropertyDataHash::const_iterator aEnd = mxInfo->maMap.end(), aIter; - for ( sal_Int32 i = 0; i < nCount; ++i, ++pString, ++pAny ) - { - aIter = mxInfo->maMap.find ( *pString ); - if ( aIter == aEnd ) - throw RuntimeException( *pString, static_cast< XPropertySet* >( this ) ); + //!! have a unique_ptr to an array of OGuards in order to have the + //!! allocated memory properly freed (exception safe!). + //!! Since the array itself has unique_ptrs as members we have to use a + //!! helper class 'AutoOGuardArray' in order to have + //!! the acquired locks properly released. + AutoOGuardArray aOGuardArray( nCount ); - if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours ! - _setSingleValue( *((*aIter).second->mpInfo), *pAny ); - else + for ( sal_Int32 i = 0; i < nCount; ++i, ++pString, ++pAny ) + { + aIter = mxInfo->maMap.find ( *pString ); + if ( aIter == aEnd ) + throw RuntimeException( *pString, static_cast< XPropertySet* >( this ) ); + + if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours ! + _setSingleValue( *((*aIter).second->mpInfo), *pAny ); + else + { + SlaveData * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]; + if (!pSlave->IsInit()) { - SlaveData * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]; - if (!pSlave->IsInit()) - { - // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - if (pSlave->mxSlave->mpMutex) - aOGuardArray[i].reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mxSlave->mpMutex) ); + // acquire mutex in c-tor and releases it in the d-tor (exception safe!). + if (pSlave->mxSlave->mpMutex) + aOGuardArray[i].reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mxSlave->mpMutex) ); - pSlave->mxSlave->_preSetValues(); - pSlave->SetInit ( true ); - } - pSlave->mxSlave->_setSingleValue( *((*aIter).second->mpInfo), *pAny ); + pSlave->mxSlave->_preSetValues(); + pSlave->SetInit ( true ); } + pSlave->mxSlave->_setSingleValue( *((*aIter).second->mpInfo), *pAny ); } + } - _postSetValues(); - for( const auto& rSlave : maSlaveMap ) + _postSetValues(); + for( const auto& rSlave : maSlaveMap ) + { + if( rSlave.second->IsInit() ) { - if( rSlave.second->IsInit() ) - { - rSlave.second->mxSlave->_postSetValues(); - rSlave.second->SetInit( false ); - } + rSlave.second->mxSlave->_postSetValues(); + rSlave.second->SetInit( false ); } } } |