summaryrefslogtreecommitdiff
path: root/cppuhelper/source
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2011-03-18 15:58:02 +0100
committerJan Holesovsky <kendy@suse.cz>2011-03-18 15:58:02 +0100
commita3a19632f413a6fe8dee97f02d637e7197869b50 (patch)
treeb8a01b5b560e18bdb007ec5ff2fafd50a3c508a9 /cppuhelper/source
parent999dce7d69e20561c3f39476e074043838eb7514 (diff)
parent793a9a799346aebbf0a50d8d4f15081d9032d57c (diff)
Merge remote-tracking branch 'origin/integration/dev300_m101'
Conflicts: bridges/source/remote/urp/urp_environment.cxx bridges/source/remote/urp/urp_propertyobject.cxx bridges/source/remote/urp/urp_reader.cxx remotebridges/source/factory/bridgefactory.cxx stoc/source/corereflection/crefl.cxx stoc/source/javavm/javavm.cxx stoc/source/simpleregistry/simpleregistry.cxx
Diffstat (limited to 'cppuhelper/source')
-rw-r--r--cppuhelper/source/bootstrap.cxx10
-rwxr-xr-xcppuhelper/source/cc5_solaris_sparc.map6
-rw-r--r--cppuhelper/source/factory.cxx8
-rw-r--r--cppuhelper/source/gcc3.map6
-rw-r--r--cppuhelper/source/msvc_win32_intel.map6
-rw-r--r--cppuhelper/source/propshlp.cxx109
-rw-r--r--cppuhelper/source/servicefactory.cxx73
-rw-r--r--cppuhelper/source/tdmgr.cxx34
8 files changed, 200 insertions, 52 deletions
diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index 54e1e7e70dfe..7762ef0df41e 100644
--- a/cppuhelper/source/bootstrap.cxx
+++ b/cppuhelper/source/bootstrap.cxx
@@ -381,9 +381,15 @@ SAL_CALL defaultBootstrap_InitialComponentContext(
Bootstrap const & bootstrap )
SAL_THROW( (Exception) )
{
- OUString bootstrapPath( get_this_libpath() );
- OUString iniDir;
+ OUString bootstrapPath;
+ if (!bootstrap.getFrom(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URE_INTERNAL_LIB_DIR")),
+ bootstrapPath))
+ {
+ bootstrapPath = get_this_libpath();
+ }
+ OUString iniDir;
osl_getProcessWorkingDir(&iniDir.pData);
Reference<lang::XMultiComponentFactory> smgr_XMultiComponentFactory(
diff --git a/cppuhelper/source/cc5_solaris_sparc.map b/cppuhelper/source/cc5_solaris_sparc.map
index d43ea690e11a..5dd703cf9fc9 100755
--- a/cppuhelper/source/cc5_solaris_sparc.map
+++ b/cppuhelper/source/cc5_solaris_sparc.map
@@ -387,3 +387,9 @@ UDK_3.7 { # OOo 3.3
__1cDcomDsunEstarDunoTWeakReferenceHelperFclear6M_v_;
__1cEcppubHcreateOneInstanceComponentFactory6FpFrknDcomDsunEstarDunoJReference4n0ERXComponentContext____n0EJReference4n0EKXInterface___rknDrtlIOUString_rkn0EISequence4n0K___pnQ_rtl_ModuleCount__n0EJReference4n0DElangXXSingleComponentFactory____;
} UDK_3.6;
+
+UDK_3.8 { # OOo 3.4
+ global:
+ __1cEcppuSOPropertySetHelperbDsetDependentFastPropertyValue6MlrknDcomDsunEstarDunoDAny__v_;
+} UDK_3.7;
+
diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx
index af2df37e79e1..3135c3447619 100644
--- a/cppuhelper/source/factory.cxx
+++ b/cppuhelper/source/factory.cxx
@@ -229,9 +229,17 @@ Reference< XInterface > OSingleFactoryHelper::createInstanceWithArgumentsAndCont
else
{
if ( rArguments.getLength() )
+ {
+ // dispose the here created UNO object before throwing out exception
+ // to avoid risk of memory leaks #i113722#
+ Reference<XComponent> xComp( xRet, UNO_QUERY );
+ if (xComp.is())
+ xComp->dispose();
+
throw lang::IllegalArgumentException(
OUString( RTL_CONSTASCII_USTRINGPARAM("cannot pass arguments to component => no XInitialization implemented!") ),
Reference< XInterface >(), 0 );
+ }
}
return xRet;
diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map
index 59ab83e34e82..7017d274c95d 100644
--- a/cppuhelper/source/gcc3.map
+++ b/cppuhelper/source/gcc3.map
@@ -382,3 +382,9 @@ UDK_3.6 { # OOo 3.3
_ZN4cppu33createOneInstanceComponentFactoryEPFN3com3sun4star3uno9ReferenceINS3_10XInterfaceEEERKNS4_INS3_17XComponentContextEEEERKN3rtl8OUStringERKNS3_8SequenceISE_EEP16_rtl_ModuleCount;
} UDK_3.5;
+
+UDK_3.7 { # OOo 3.4
+ global:
+ _ZN4cppu18OPropertySetHelper29setDependentFastPropertyValueE?RKN3com3sun4star3uno3AnyE;
+} UDK_3.6;
+
diff --git a/cppuhelper/source/msvc_win32_intel.map b/cppuhelper/source/msvc_win32_intel.map
index 6d5a491ab925..7069276e2baa 100644
--- a/cppuhelper/source/msvc_win32_intel.map
+++ b/cppuhelper/source/msvc_win32_intel.map
@@ -278,3 +278,9 @@ UDK_3.6 { # OOo 3.3
?clear@WeakReferenceHelper@uno@star@sun@com@@QAAXXZ;
?createOneInstanceComponentFactory@cppu@@YA?AV?$Reference@VXSingleComponentFactory@lang@star@sun@com@@@uno@star@sun@com@@P6A?AV?$Reference@VXInterface@uno@star@sun@com@@@3456@ABV?$Reference@VXComponentContext@uno@star@sun@com@@@3456@@ZABVOUString@rtl@@ABV?$Sequence@VOUString@rtl@@@3456@PAU_rtl_ModuleCount@@@Z;
} UDK_3.5;
+
+UDK_3.7 { # OOo 3.4
+ global:
+ ?setDependentFastPropertyValue@OPropertySetHelper@cppu@@IAEXJABVAny@uno@star@sun@com@@@Z;
+} UDK_3.6;
+
diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx
index 0cc3e14f2133..1305de692890 100644
--- a/cppuhelper/source/propshlp.cxx
+++ b/cppuhelper/source/propshlp.cxx
@@ -33,6 +33,7 @@
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/weak.hxx"
#include "cppuhelper/propshlp.hxx"
+#include "cppuhelper/exc_hlp.hxx"
#include "com/sun/star/beans/PropertyAttribute.hpp"
#include "com/sun/star/lang/DisposedException.hpp"
@@ -147,15 +148,20 @@ sal_Bool OPropertySetHelperInfo_Impl::hasPropertyByName( const OUString & Proper
class OPropertySetHelper::Impl {
public:
- Impl ( bool i_bIgnoreRuntimeExceptionsWhileFiring,
- IEventNotificationHook *i_pFireEvents)
- : m_bIgnoreRuntimeExceptionsWhileFiring(
- i_bIgnoreRuntimeExceptionsWhileFiring ),
- m_pFireEvents( i_pFireEvents )
- { }
+ Impl( bool i_bIgnoreRuntimeExceptionsWhileFiring,
+ IEventNotificationHook *i_pFireEvents
+ )
+ :m_bIgnoreRuntimeExceptionsWhileFiring( i_bIgnoreRuntimeExceptionsWhileFiring )
+ ,m_pFireEvents( i_pFireEvents )
+ {
+ }
bool m_bIgnoreRuntimeExceptionsWhileFiring;
class IEventNotificationHook * const m_pFireEvents;
+
+ ::std::vector< sal_Int32 > m_handles;
+ ::std::vector< Any > m_newValues;
+ ::std::vector< Any > m_oldValues;
};
@@ -435,6 +441,57 @@ void OPropertySetHelper::removeVetoableChangeListener(
}
}
+void OPropertySetHelper::setDependentFastPropertyValue( sal_Int32 i_handle, const ::com::sun::star::uno::Any& i_value )
+{
+ //OSL_PRECOND( rBHelper.rMutex.isAcquired(), "OPropertySetHelper::setDependentFastPropertyValue: to be called with a locked mutex only!" );
+ // there is no such thing as Mutex.isAcquired, sadly ...
+
+ sal_Int16 nAttributes(0);
+ IPropertyArrayHelper& rInfo = getInfoHelper();
+ if ( !rInfo.fillPropertyMembersByHandle( NULL, &nAttributes, i_handle ) )
+ // unknown property
+ throw UnknownPropertyException();
+
+ // no need to check for READONLY-ness of the property. The method is intended to be called internally, which
+ // implies it might be invoked for properties which are read-only to the instance's clients, but well allowed
+ // to change their value.
+
+ Any aConverted, aOld;
+ sal_Bool bChanged = convertFastPropertyValue( aConverted, aOld, i_handle, i_value );
+ if ( !bChanged )
+ return;
+
+ // don't fire vetoable events. This method is called with our mutex locked, so calling into listeners would not be
+ // a good idea. The caler is responsible for not invoking this for constrained properties.
+ OSL_ENSURE( ( nAttributes & PropertyAttribute::CONSTRAINED ) == 0,
+ "OPropertySetHelper::setDependentFastPropertyValue: not to be used for constrained properties!" );
+ (void)nAttributes;
+
+ // actually set the new value
+ try
+ {
+ setFastPropertyValue_NoBroadcast( i_handle, aConverted );
+ }
+ catch (const UnknownPropertyException& ) { throw; /* allowed to leave */ }
+ catch (const PropertyVetoException& ) { throw; /* allowed to leave */ }
+ catch (const IllegalArgumentException& ) { throw; /* allowed to leave */ }
+ catch (const WrappedTargetException& ) { throw; /* allowed to leave */ }
+ catch (const RuntimeException& ) { throw; /* allowed to leave */ }
+ catch (const Exception& )
+ {
+ // not allowed to leave this meathod
+ WrappedTargetException aWrapped;
+ aWrapped.TargetException <<= ::cppu::getCaughtException();
+ aWrapped.Context = static_cast< XPropertySet* >( this );
+ throw aWrapped;
+ }
+
+ // remember the handle/values, for the events to be fired later
+ m_pReserved->m_handles.push_back( i_handle );
+ m_pReserved->m_newValues.push_back( aConverted ); // TODO: setFastPropertyValue notifies the unconverted value here ...?
+ m_pReserved->m_oldValues.push_back( aOld );
+}
+
// XFastPropertySet
void OPropertySetHelper::setFastPropertyValue( sal_Int32 nHandle, const Any& rValue )
throw(::com::sun::star::beans::UnknownPropertyException,
@@ -501,7 +558,7 @@ void OPropertySetHelper::setFastPropertyValue( sal_Int32 nHandle, const Any& rVa
// release guard to fire events
}
// file a change event, if the value changed
- fire( &nHandle, &rValue, &aOldVal, 1, sal_False );
+ impl_fireAll( &nHandle, &rValue, &aOldVal, 1 );
}
}
@@ -524,6 +581,42 @@ Any OPropertySetHelper::getFastPropertyValue( sal_Int32 nHandle )
}
//--------------------------------------------------------------------------
+void OPropertySetHelper::impl_fireAll( sal_Int32* i_handles, const Any* i_newValues, const Any* i_oldValues, sal_Int32 i_count )
+{
+ ClearableMutexGuard aGuard( rBHelper.rMutex );
+ if ( m_pReserved->m_handles.empty() )
+ {
+ aGuard.clear();
+ fire( i_handles, i_newValues, i_oldValues, i_count, sal_False );
+ return;
+ }
+
+ const size_t additionalEvents = m_pReserved->m_handles.size();
+ OSL_ENSURE( additionalEvents == m_pReserved->m_newValues.size()
+ && additionalEvents == m_pReserved->m_oldValues.size(),
+ "OPropertySetHelper::impl_fireAll: inconsistency!" );
+
+ ::std::vector< sal_Int32 > allHandles( additionalEvents + i_count );
+ ::std::copy( m_pReserved->m_handles.begin(), m_pReserved->m_handles.end(), allHandles.begin() );
+ ::std::copy( i_handles, i_handles + i_count, allHandles.begin() + additionalEvents );
+
+ ::std::vector< Any > allNewValues( additionalEvents + i_count );
+ ::std::copy( m_pReserved->m_newValues.begin(), m_pReserved->m_newValues.end(), allNewValues.begin() );
+ ::std::copy( i_newValues, i_newValues + i_count, allNewValues.begin() + additionalEvents );
+
+ ::std::vector< Any > allOldValues( additionalEvents + i_count );
+ ::std::copy( m_pReserved->m_oldValues.begin(), m_pReserved->m_oldValues.end(), allOldValues.begin() );
+ ::std::copy( i_oldValues, i_oldValues + i_count, allOldValues.begin() + additionalEvents );
+
+ m_pReserved->m_handles.clear();
+ m_pReserved->m_newValues.clear();
+ m_pReserved->m_oldValues.clear();
+
+ aGuard.clear();
+ fire( &allHandles[0], &allNewValues[0], &allOldValues[0], additionalEvents + i_count, sal_False );
+}
+
+//--------------------------------------------------------------------------
void OPropertySetHelper::fire
(
sal_Int32 * pnHandles,
@@ -806,7 +899,7 @@ void OPropertySetHelper::setFastPropertyValues(
}
// fire change events
- fire( pHandles, pConvertedValues, pOldValues, n, sal_False );
+ impl_fireAll( pHandles, pConvertedValues, pOldValues, n );
}
catch( ... )
{
diff --git a/cppuhelper/source/servicefactory.cxx b/cppuhelper/source/servicefactory.cxx
index 22058bb14082..742f94ac5f97 100644
--- a/cppuhelper/source/servicefactory.cxx
+++ b/cppuhelper/source/servicefactory.cxx
@@ -29,13 +29,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cppuhelper.hxx"
-#if OSL_DEBUG_LEVEL > 0
-#include <stdio.h>
-#endif
#include <vector>
#include "rtl/string.hxx"
-#include "rtl/ustrbuf.hxx"
#include "rtl/bootstrap.hxx"
#include "osl/diagnose.h"
#include "osl/file.h"
@@ -47,6 +43,7 @@
#include "cppuhelper/servicefactory.hxx"
#include "cppuhelper/bootstrap.hxx"
+#include "com/sun/star/uno/DeploymentException.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/lang/XInitialization.hpp"
#include "com/sun/star/lang/XSingleServiceFactory.hpp"
@@ -65,6 +62,7 @@ using namespace ::rtl;
using namespace ::osl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
+namespace css = com::sun::star;
namespace cppu
{
@@ -418,39 +416,42 @@ Reference< XComponentContext > bootstrapInitialContext(
keys.getConstArray();
for ( sal_Int32 nPos = keys.getLength(); nPos--; )
{
- Reference< registry::XRegistryKey > const & xKey2 =
- pKeys[ nPos ];
- try
- {
- OUStringBuffer buf( 32 );
- buf.appendAscii(
- RTL_CONSTASCII_STRINGPARAM("/singletons/") );
- buf.append(
- xKey2->getKeyName().copy(
- sizeof("/SINGLETONS") /* -\0 +'/' */ ) );
- entry.name = buf.makeStringAndClear();
- entry.value <<= xKey2->getStringValue();
- context_values.push_back( entry );
- }
- catch (Exception & rExc)
- {
-#if OSL_DEBUG_LEVEL > 0
- OString aStr(
- OUStringToOString(
- xKey2->getKeyName().copy( 11 ),
- RTL_TEXTENCODING_ASCII_US ) );
- OString aStr2(
- OUStringToOString(
- rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
- fprintf(
- stderr,
- "### failed reading singleton [%s]"
- " service name from registry: %s\n",
- aStr.getStr(), aStr2.getStr() );
-#else
- (void) rExc; // avoid warning about unused variable
-#endif
+ css::uno::Sequence< rtl::OUString > impls(
+ css::uno::Reference< css::registry::XRegistryKey >(
+ pKeys[nPos]->openKey(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "REGISTERED_BY"))),
+ css::uno::UNO_SET_THROW)->getAsciiListValue());
+ switch (impls.getLength()) {
+ case 0:
+ throw css::uno::DeploymentException(
+ (pKeys[nPos]->getKeyName() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/REGISTERED_BY is empty"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case 1:
+ break;
+ default:
+ OSL_TRACE(
+ ("arbitrarily chosing \"%s\" among multiple"
+ " implementations for \"%s\""),
+ rtl::OUStringToOString(
+ impls[0], RTL_TEXTENCODING_UTF8).getStr(),
+ rtl::OUStringToOString(
+ pKeys[nPos]->getKeyName(),
+ RTL_TEXTENCODING_UTF8).getStr());
+ break;
}
+ context_values.push_back(
+ ContextEntry_Init(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("/singletons/")) +
+ pKeys[nPos]->getKeyName().copy(
+ RTL_CONSTASCII_LENGTH("/SINGLETONS/"))),
+ css::uno::makeAny(impls[0]),
+ true));
}
}
}
diff --git a/cppuhelper/source/tdmgr.cxx b/cppuhelper/source/tdmgr.cxx
index 291d514fcd80..7090adbe90d3 100644
--- a/cppuhelper/source/tdmgr.cxx
+++ b/cppuhelper/source/tdmgr.cxx
@@ -28,6 +28,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cppuhelper.hxx"
+
+#include "sal/config.h"
+
+#include <vector>
+
#include <sal/alloca.h>
#include <osl/diagnose.h>
@@ -46,7 +51,7 @@
#include <com/sun/star/reflection/XEnumTypeDescription.hpp>
#include <com/sun/star/reflection/XIndirectTypeDescription.hpp>
#include <com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp>
-#include <com/sun/star/reflection/XInterfaceAttributeTypeDescription.hpp>
+#include <com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp>
#include <com/sun/star/reflection/XMethodParameter.hpp>
#include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
#include <com/sun/star/reflection/XInterfaceTypeDescription2.hpp>
@@ -303,7 +308,7 @@ inline static typelib_TypeDescription * createCTD(
}
//==================================================================================================
inline static typelib_TypeDescription * createCTD(
- const Reference< XInterfaceAttributeTypeDescription > & xAttribute )
+ const Reference< XInterfaceAttributeTypeDescription2 > & xAttribute )
{
typelib_TypeDescription * pRet = 0;
if (xAttribute.is())
@@ -311,14 +316,31 @@ inline static typelib_TypeDescription * createCTD(
OUString aMemberName( xAttribute->getName() );
Reference< XTypeDescription > xType( xAttribute->getType() );
OUString aMemberTypeName( xType->getName() );
-
- typelib_typedescription_newInterfaceAttribute(
+ std::vector< rtl_uString * > getExc;
+ Sequence< Reference< XCompoundTypeDescription > > getExcs(
+ xAttribute->getGetExceptions() );
+ for (sal_Int32 i = 0; i != getExcs.getLength(); ++i)
+ {
+ OSL_ASSERT( getExcs[i].is() );
+ getExc.push_back( getExcs[i]->getName().pData );
+ }
+ std::vector< rtl_uString * > setExc;
+ Sequence< Reference< XCompoundTypeDescription > > setExcs(
+ xAttribute->getSetExceptions() );
+ for (sal_Int32 i = 0; i != setExcs.getLength(); ++i)
+ {
+ OSL_ASSERT( setExcs[i].is() );
+ setExc.push_back( setExcs[i]->getName().pData );
+ }
+ typelib_typedescription_newExtendedInterfaceAttribute(
(typelib_InterfaceAttributeTypeDescription **)&pRet,
xAttribute->getPosition(),
aMemberName.pData, // name
(typelib_TypeClass)xType->getTypeClass(),
aMemberTypeName.pData, // type name
- xAttribute->isReadOnly() );
+ xAttribute->isReadOnly(),
+ getExc.size(), getExc.empty() ? 0 : &getExc[0],
+ setExc.size(), setExc.empty() ? 0 : &setExc[0] );
}
return pRet;
}
@@ -643,7 +665,7 @@ static typelib_TypeDescription * createCTD(
pRet = createCTD( Reference< XInterfaceMethodTypeDescription >::query( xType ) );
break;
case TypeClass_INTERFACE_ATTRIBUTE:
- pRet = createCTD( Reference< XInterfaceAttributeTypeDescription >::query( xType ) );
+ pRet = createCTD( Reference< XInterfaceAttributeTypeDescription2 >::query( xType ) );
break;
default:
break;