From ee66e1112de4dc058ebdbb920beea7f8b85f5900 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 4 Mar 2025 11:44:17 +0200 Subject: [PATCH] more type-safety in odbc::ODBCDriver Change-Id: I5db758cd282299ccd15872195a292224827d0c97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182468 Reviewed-by: Noel Grandin Tested-by: Jenkins --- connectivity/source/drivers/odbc/ODriver.cxx | 4 ++-- connectivity/source/inc/odbc/ODriver.hxx | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/connectivity/source/drivers/odbc/ODriver.cxx b/connectivity/source/drivers/odbc/ODriver.cxx index 9df42f2ae00f..6e9b28082c11 100644 --- a/connectivity/source/drivers/odbc/ODriver.cxx +++ b/connectivity/source/drivers/odbc/ODriver.cxx @@ -49,7 +49,7 @@ void ODBCDriver::disposing() for (auto const& connection : m_xConnections) { - Reference< XComponent > xComp(connection.get(), UNO_QUERY); + rtl::Reference< OConnection > xComp(connection); if (xComp.is()) xComp->dispose(); } @@ -87,7 +87,7 @@ Reference< XConnection > SAL_CALL ODBCDriver::connect( const OUString& url, cons rtl::Reference pCon = new OConnection(EnvironmentHandle(), this); pCon->Construct(url,info); - m_xConnections.push_back(WeakReferenceHelper(*pCon)); + m_xConnections.push_back(pCon); return pCon; } diff --git a/connectivity/source/inc/odbc/ODriver.hxx b/connectivity/source/inc/odbc/ODriver.hxx index 505a37c01190..721f46338022 100644 --- a/connectivity/source/inc/odbc/ODriver.hxx +++ b/connectivity/source/inc/odbc/ODriver.hxx @@ -29,9 +29,12 @@ #include #include #include +#include namespace connectivity::odbc { + class OConnection; + typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, css::lang::XServiceInfo > ODriver_BASE; class OOO_DLLPUBLIC_ODBCBASE SAL_NO_VTABLE ODBCDriver : public ODriver_BASE @@ -39,7 +42,8 @@ namespace connectivity::odbc protected: ::osl::Mutex m_aMutex; - connectivity::OWeakRefArray m_xConnections; // vector containing a list + std::vector> + m_xConnections; // vector containing a list // of all the Connection objects // for this Driver