Use getXWeak in connectivity

Change-Id: Id301a9321f77e5ccc1269a3b677e9faeb19a4011
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150841
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski 2023-04-23 20:13:17 +03:00
parent c6f8198361
commit e2360bfd62
10 changed files with 11 additions and 14 deletions

View file

@ -78,7 +78,7 @@ namespace dbtools
void OAutoConnectionDisposer::stopPropertyListening( const Reference< XPropertySet >& _rxEventSource )
{
// prevent deletion of ourself while we're herein
Reference< XInterface > xKeepAlive(static_cast< XWeak* >(this));
Reference< XInterface > xKeepAlive(getXWeak());
try
{ // remove ourself as property change listener

View file

@ -48,7 +48,7 @@ namespace connectivity
OSL_ENSURE(m_xDriver.is(), "ODriverWrapper::ODriverWrapper: invalid aggregate (no XDriver)!");
// set ourself as delegator
m_xDriverAggregate->setDelegator( static_cast< XWeak* >( this ) );
m_xDriverAggregate->setDelegator( getXWeak() );
}
osl_atomic_decrement( &m_refCount );
}

View file

@ -53,7 +53,7 @@ connectivity_calc_ODriver(
}
if (ret)
ret->acquire();
return static_cast<cppu::OWeakObject*>(ret.get());
return getXWeak(ret.get());
}

View file

@ -51,7 +51,7 @@ connectivity_dbase_ODriver(
}
if (ret)
ret->acquire();
return static_cast<cppu::OWeakObject*>(ret.get());
return getXWeak(ret.get());
}

View file

@ -912,7 +912,7 @@ Reference< XInterface > SAL_CALL OEvoabResultSet::getStatement( )
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
return static_cast<cppu::OWeakObject*>(m_pStatement);
return cppu::getXWeak(m_pStatement);
}

View file

@ -54,7 +54,7 @@ connectivity_flat_ODriver(
}
if (ret)
ret->acquire();
return static_cast<cppu::OWeakObject*>(ret.get());
return getXWeak(ret.get());
}
Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const Sequence< PropertyValue >& info )

View file

@ -380,7 +380,7 @@ Any SAL_CALL java_sql_Statement_Base::getWarnings( )
java_sql_SQLWarning_BASE warn_base( t.pEnv, out );
return Any(
static_cast< css::sdbc::SQLException >(
java_sql_SQLWarning(warn_base,*static_cast<cppu::OWeakObject*>(this))));
java_sql_SQLWarning(warn_base,getXWeak())));
}
return Any();

View file

@ -183,7 +183,7 @@ OPreparedResultSet::OPreparedResultSet(OConnection& rConn, OPreparedStatement* p
: OPreparedResultSet_BASE(m_aMutex)
, OPropertySetHelper(OPreparedResultSet_BASE::rBHelper)
, m_rConnection(rConn)
, m_aStatement(css::uno::Reference<css::uno::XWeak>(static_cast<OWeakObject*>(pStmt)))
, m_aStatement(css::uno::Reference(cppu::getXWeak(pStmt)))
, m_pStmt(pMyStmt)
, m_encoding(rConn.getConnectionEncoding())
, m_nColumnCount(mysql_stmt_field_count(pMyStmt))

View file

@ -108,7 +108,7 @@ OResultSet::OResultSet(OConnection& rConn, OCommonStatement* pStmt, MYSQL_RES* p
: OResultSet_BASE(m_aMutex)
, OPropertySetHelper(OResultSet_BASE::rBHelper)
, m_pMysql(rConn.getMysqlConnection())
, m_aStatement(css::uno::Reference<css::uno::XWeak>(static_cast<OWeakObject*>(pStmt)))
, m_aStatement(css::uno::Reference(cppu::getXWeak(pStmt)))
, m_pResult(pResult)
, m_encoding(_encoding)
{

View file

@ -38,17 +38,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
connectivity_writer_ODriver(css::uno::XComponentContext* context,
css::uno::Sequence<css::uno::Any> const& /*rArguments*/)
{
rtl::Reference<ODriver> ret;
try
{
ret = new ODriver(context);
return acquire(new ODriver(context));
}
catch (...)
{
}
if (ret)
ret->acquire();
return static_cast<cppu::OWeakObject*>(ret.get());
return nullptr;
}
uno::Reference<sdbc::XConnection>