Base OSubComponent on cppu::WeakComponentImplHelper

...rather than on cppu::OComponentHelper (which derives from XAggregation) and
then manually suppressing support for XAggregation in
OSubComponent::queryInterface

Change-Id: I6718d36f20579806b508c4bf5048b734643ad716
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145476
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2023-01-13 11:03:18 +01:00
parent 1fd4e669a9
commit 4aa8f40f66
6 changed files with 106 additions and 133 deletions

View file

@ -2737,7 +2737,7 @@ void ORowSet::impl_rebuild_throw(::osl::ResettableMutexGuard& _rGuard)
ORowSetClone::ORowSetClone( const Reference<XComponentContext>& _rContext, ORowSet& rParent, ::osl::Mutex* _pMutex )
:OSubComponent(m_aMutex, rParent)
,ORowSetBase( _rContext, OComponentHelper::rBHelper, _pMutex )
,ORowSetBase( _rContext, WeakComponentImplHelper::rBHelper, _pMutex )
,m_pParent(&rParent)
,m_nFetchDirection(rParent.m_nFetchDirection)
,m_nFetchSize(rParent.m_nFetchSize)
@ -2883,7 +2883,7 @@ void ORowSetClone::close()
{
{
MutexGuard aGuard( m_aMutex );
if (OComponentHelper::rBHelper.bDisposed)
if (WeakComponentImplHelper::rBHelper.bDisposed)
throw DisposedException();
}
dispose();

View file

@ -84,7 +84,7 @@ void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
Reference< XOutParameters >(m_xAggregateAsSet, UNO_QUERY_THROW)->registerOutParameter( parameterIndex, sqlType, typeName );
}
@ -92,7 +92,7 @@ void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex
void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
Reference< XOutParameters >(m_xAggregateAsSet, UNO_QUERY_THROW)->registerNumericOutParameter( parameterIndex, sqlType, scale );
}
@ -101,7 +101,7 @@ void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 paramet
sal_Bool SAL_CALL OCallableStatement::wasNull( )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->wasNull();
}
@ -109,7 +109,7 @@ sal_Bool SAL_CALL OCallableStatement::wasNull( )
OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getString( columnIndex );
}
@ -117,7 +117,7 @@ OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex )
sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBoolean( columnIndex );
}
@ -125,7 +125,7 @@ sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex )
sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getByte( columnIndex );
}
@ -133,63 +133,63 @@ sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex )
sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getShort( columnIndex );
}
sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getInt( columnIndex );
}
sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getLong( columnIndex );
}
float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getFloat( columnIndex );
}
double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getDouble( columnIndex );
}
Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBytes( columnIndex );
}
css::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getDate( columnIndex );
}
css::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getTime( columnIndex );
}
css::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getTimestamp( columnIndex );
}
@ -197,7 +197,7 @@ css::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnI
Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBinaryStream( columnIndex );
}
@ -205,7 +205,7 @@ Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream(
Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStream( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getCharacterStream( columnIndex );
}
@ -213,7 +213,7 @@ Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStre
Any SAL_CALL OCallableStatement::getObject( sal_Int32 columnIndex, const Reference< css::container::XNameAccess >& typeMap )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getObject( columnIndex, typeMap );
}
@ -221,28 +221,28 @@ Any SAL_CALL OCallableStatement::getObject( sal_Int32 columnIndex, const Referen
Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getRef( columnIndex );
}
Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBlob( columnIndex );
}
Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getClob( columnIndex );
}
Reference< XArray > SAL_CALL OCallableStatement::getArray( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getArray( columnIndex );
}

View file

@ -135,7 +135,7 @@ void OPreparedStatement::disposing()
Reference< css::container::XNameAccess > OPreparedStatement::getColumns()
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// do we have to populate the columns
if (!m_pColumns->isInitialized())
@ -175,7 +175,7 @@ Reference< css::container::XNameAccess > OPreparedStatement::getColumns()
Reference< XResultSetMetaData > OPreparedStatement::getMetaData()
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XResultSetMetaDataSupplier >( m_xAggregateAsSet, UNO_QUERY_THROW )->getMetaData();
}
@ -183,7 +183,7 @@ Reference< XResultSetMetaData > OPreparedStatement::getMetaData()
Reference< XResultSet > OPreparedStatement::executeQuery()
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@ -202,7 +202,7 @@ Reference< XResultSet > OPreparedStatement::executeQuery()
sal_Int32 OPreparedStatement::executeUpdate()
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@ -212,7 +212,7 @@ sal_Int32 OPreparedStatement::executeUpdate()
sal_Bool OPreparedStatement::execute()
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@ -228,7 +228,7 @@ Reference< XConnection > OPreparedStatement::getConnection()
void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setNull(parameterIndex, sqlType);
}
@ -236,7 +236,7 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s
void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setObjectNull(parameterIndex, sqlType, typeName);
}
@ -244,7 +244,7 @@ void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_I
void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setBoolean(parameterIndex, x);
}
@ -252,7 +252,7 @@ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool
void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setByte(parameterIndex, x);
}
@ -260,7 +260,7 @@ void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x
void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setShort(parameterIndex, x);
}
@ -268,7 +268,7 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16
void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setInt(parameterIndex, x);
}
@ -276,7 +276,7 @@ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x
void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setLong(parameterIndex, x);
}
@ -284,7 +284,7 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x
void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setFloat(parameterIndex, x);
}
@ -292,7 +292,7 @@ void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x )
void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setDouble(parameterIndex, x);
}
@ -300,7 +300,7 @@ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x
void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const OUString& x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setString(parameterIndex, x);
}
@ -308,7 +308,7 @@ void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const OUS
void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setBytes(parameterIndex, x);
}
@ -316,7 +316,7 @@ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequ
void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const css::util::Date& x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setDate(parameterIndex, x);
}
@ -324,7 +324,7 @@ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const css::
void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const css::util::Time& x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setTime(parameterIndex, x);
}
@ -332,7 +332,7 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const css::
void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setTimestamp(parameterIndex, x);
}
@ -340,7 +340,7 @@ void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const
void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< css::io::XInputStream >& x, sal_Int32 length )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setBinaryStream(parameterIndex, x, length);
}
@ -348,7 +348,7 @@ void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, con
void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< css::io::XInputStream >& x, sal_Int32 length )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setCharacterStream(parameterIndex, x, length);
}
@ -356,7 +356,7 @@ void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex,
void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setObject(parameterIndex, x);
}
@ -364,7 +364,7 @@ void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any
void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 scale )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setObjectWithInfo(parameterIndex, x, targetSqlType, scale);
}
@ -372,7 +372,7 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setRef(parameterIndex, x);
}
@ -380,7 +380,7 @@ void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Refere
void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setBlob(parameterIndex, x);
}
@ -388,7 +388,7 @@ void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Refer
void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setClob(parameterIndex, x);
}
@ -396,7 +396,7 @@ void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Refer
void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setArray(parameterIndex, x);
}
@ -404,7 +404,7 @@ void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Refe
void SAL_CALL OPreparedStatement::clearParameters( )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->clearParameters();
}

View file

@ -46,7 +46,7 @@ using namespace dbtools;
OStatementBase::OStatementBase(const Reference< XConnection > & _xConn,
const Reference< XInterface > & _xStatement)
:OSubComponent(m_aMutex, _xConn)
,OPropertySetHelper(OComponentHelper::rBHelper)
,OPropertySetHelper(WeakComponentImplHelper::rBHelper)
,m_bUseBookmarks( false )
,m_bEscapeProcessing( true )
@ -164,7 +164,7 @@ void OStatementBase::close()
{
{
MutexGuard aGuard( m_aMutex );
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
}
dispose();
}
@ -293,7 +293,7 @@ void OStatementBase::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons
Any OStatementBase::getWarnings()
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XWarningsSupplier >(m_xAggregateAsSet, UNO_QUERY_THROW)->getWarnings();
}
@ -301,7 +301,7 @@ Any OStatementBase::getWarnings()
void OStatementBase::clearWarnings()
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
Reference< XWarningsSupplier >(m_xAggregateAsSet, UNO_QUERY_THROW)->clearWarnings();
}
@ -320,7 +320,7 @@ void OStatementBase::cancel()
Reference< XResultSet > SAL_CALL OStatementBase::getResultSet( )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@ -333,7 +333,7 @@ Reference< XResultSet > SAL_CALL OStatementBase::getResultSet( )
sal_Int32 SAL_CALL OStatementBase::getUpdateCount( )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@ -346,7 +346,7 @@ sal_Int32 SAL_CALL OStatementBase::getUpdateCount( )
sal_Bool SAL_CALL OStatementBase::getMoreResults( )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@ -363,7 +363,7 @@ sal_Bool SAL_CALL OStatementBase::getMoreResults( )
void SAL_CALL OStatementBase::addBatch( )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@ -376,7 +376,7 @@ void SAL_CALL OStatementBase::addBatch( )
void SAL_CALL OStatementBase::clearBatch( )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@ -389,7 +389,7 @@ void SAL_CALL OStatementBase::clearBatch( )
Sequence< sal_Int32 > SAL_CALL OStatementBase::executeBatch( )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@ -405,7 +405,7 @@ Sequence< sal_Int32 > SAL_CALL OStatementBase::executeBatch( )
Reference< XResultSet > SAL_CALL OStatementBase::getGeneratedValues( )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
Reference< XGeneratedResultSet > xGRes(m_xAggregateAsSet, UNO_QUERY);
if ( xGRes.is() )
@ -446,7 +446,7 @@ Sequence< OUString > OStatement::getSupportedServiceNames( )
Reference< XResultSet > OStatement::executeQuery( const OUString& _rSQL )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
Reference< XResultSet > xResultSet;
@ -472,7 +472,7 @@ Reference< XResultSet > OStatement::executeQuery( const OUString& _rSQL )
sal_Int32 OStatement::executeUpdate( const OUString& _rSQL )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@ -483,7 +483,7 @@ sal_Int32 OStatement::executeUpdate( const OUString& _rSQL )
sal_Bool OStatement::execute( const OUString& _rSQL )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@ -494,7 +494,7 @@ sal_Bool OStatement::execute( const OUString& _rSQL )
void OStatement::addBatch( const OUString& _rSQL )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@ -508,7 +508,7 @@ void OStatement::addBatch( const OUString& _rSQL )
void OStatement::clearBatch( )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
if (!xMeta.is() || !xMeta->supportsBatchUpdates())
@ -520,7 +520,7 @@ void OStatement::clearBatch( )
Sequence< sal_Int32 > OStatement::executeBatch( )
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
if (!xMeta.is() || !xMeta->supportsBatchUpdates())

View file

@ -29,7 +29,7 @@ using namespace osl;
// various helper functions
// OSubComponent
OSubComponent::OSubComponent(Mutex& _rMutex, const Reference< XInterface > & xParent)
:OComponentHelper(_rMutex)
:WeakComponentImplHelper(_rMutex)
,m_xParent(xParent)
{
@ -41,74 +41,51 @@ OSubComponent::~OSubComponent()
}
// css::lang::XTypeProvider
Sequence< Type > OSubComponent::getTypes()
{
OTypeCollection aTypes(cppu::UnoType<XComponent>::get(),
cppu::UnoType<XTypeProvider>::get(),
cppu::UnoType<XWeak>::get());
return aTypes.getTypes();
}
// XInterface
void OSubComponent::release() noexcept
{
Reference< XInterface > x( xDelegator );
if (! x.is())
if (osl_atomic_decrement( &m_refCount ) == 0 )
{
if (osl_atomic_decrement( &m_refCount ) == 0 )
if (! rBHelper.bDisposed)
{
if (! rBHelper.bDisposed)
// *before* again incrementing our ref count, ensure that our weak connection point
// will not create references to us anymore (via XAdapter::queryAdapted)
disposeWeakConnectionPoint();
Reference< XInterface > xHoldAlive( *this );
// remember the parent
Reference< XInterface > xParent;
{
// *before* again incrementing our ref count, ensure that our weak connection point
// will not create references to us anymore (via XAdapter::queryAdapted)
disposeWeakConnectionPoint();
Reference< XInterface > xHoldAlive( *this );
// remember the parent
Reference< XInterface > xParent;
{
MutexGuard aGuard( rBHelper.rMutex );
xParent = m_xParent;
m_xParent = nullptr;
}
SAL_WARN_IF( m_refCount != 1, "dbaccess.core", "OSubComponent::release: invalid ref count (before dispose)!" );
// First dispose
dispose();
// only the alive ref holds the object
SAL_WARN_IF( m_refCount != 1, "dbaccess.core", "OSubComponent::release: invalid ref count (after dispose)!" );
// release the parent in the ~
if (xParent.is())
{
MutexGuard aGuard( rBHelper.rMutex );
m_xParent = xParent;
}
// destroy the object if xHoldAlive decrement the refcount to 0
return;
MutexGuard aGuard( rBHelper.rMutex );
xParent = m_xParent;
m_xParent = nullptr;
}
SAL_WARN_IF( m_refCount != 1, "dbaccess.core", "OSubComponent::release: invalid ref count (before dispose)!" );
// First dispose
dispose();
// only the alive ref holds the object
SAL_WARN_IF( m_refCount != 1, "dbaccess.core", "OSubComponent::release: invalid ref count (after dispose)!" );
// release the parent in the ~
if (xParent.is())
{
MutexGuard aGuard( rBHelper.rMutex );
m_xParent = xParent;
}
// destroy the object if xHoldAlive decrement the refcount to 0
return;
}
// restore the reference count
osl_atomic_increment( &m_refCount );
}
// restore the reference count
osl_atomic_increment( &m_refCount );
// as we cover the job of the componenthelper we use the ...
OWeakAggObject::release();
}
Any OSubComponent::queryInterface( const Type & rType )
{
Any aReturn;
if (!rType.equals(cppu::UnoType<XAggregation>::get()))
aReturn = OComponentHelper::queryInterface(rType);
return aReturn;
// as we cover the job of the WeakComponentImplHelper we use the ...
OWeakObject::release();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -21,12 +21,12 @@
#include <sal/config.h>
#include <cppuhelper/component.hxx>
#include <cppuhelper/compbase.hxx>
#include <osl/mutex.hxx>
// OSubComponent - a component which holds a hard ref to its parent
// and is been hold itself (by the parent) with a weak ref
class OSubComponent : public ::cppu::OComponentHelper
class OSubComponent : public ::cppu::WeakComponentImplHelper<>
{
protected:
// the parent must support the tunnel implementation
@ -37,11 +37,7 @@ public:
OSubComponent(::osl::Mutex& _rMutex,
const css::uno::Reference< css::uno::XInterface >& _xParent);
// css::lang::XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
virtual void SAL_CALL release() noexcept override;
operator css::uno::Reference< css::uno::XInterface > () const