From 82572caae4a282cdf79456b977508ca71507c584 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 18 Sep 2019 14:15:59 +0200 Subject: improve and enable loplugin:fragiledestructor Where the problem was benign and the class was not extended, I marked the class as final. Where the problem was benign and the class was extended, I marked the relevant callee methods as final. Other cases were excluded in the plugin. Change-Id: Idb762fb2206af4e8b534aa35ff77f8368c7909bc Reviewed-on: https://gerrit.libreoffice.org/79089 Tested-by: Jenkins Reviewed-by: Noel Grandin --- connectivity/source/drivers/evoab2/NConnection.hxx | 2 +- connectivity/source/drivers/evoab2/NResultSet.cxx | 4 ++-- connectivity/source/drivers/firebird/Connection.hxx | 2 +- connectivity/source/inc/file/FConnection.hxx | 4 ++-- connectivity/source/inc/file/FResultSet.hxx | 2 +- connectivity/source/inc/odbc/OConnection.hxx | 4 +--- 6 files changed, 8 insertions(+), 10 deletions(-) (limited to 'connectivity/source') diff --git a/connectivity/source/drivers/evoab2/NConnection.hxx b/connectivity/source/drivers/evoab2/NConnection.hxx index 2b2737927b53..2ba2a8db7ea8 100644 --- a/connectivity/source/drivers/evoab2/NConnection.hxx +++ b/connectivity/source/drivers/evoab2/NConnection.hxx @@ -47,7 +47,7 @@ namespace connectivity typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding - class OEvoabConnection :public OConnection_BASE + class OEvoabConnection final :public OConnection_BASE { private: const OEvoabDriver& m_rDriver; diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx index 0c438f650479..28c7278f2010 100644 --- a/connectivity/source/drivers/evoab2/NResultSet.cxx +++ b/connectivity/source/drivers/evoab2/NResultSet.cxx @@ -435,7 +435,7 @@ public: return isBookBackend(pBook, "local"); } - virtual void freeContacts() override + virtual void freeContacts() override final { e_client_util_free_object_slist(m_pContacts); m_pContacts = nullptr; @@ -560,7 +560,7 @@ public: !strncmp( "local:", e_book_get_uri( pBook ), 6 ) ); } - virtual void freeContacts() override + virtual void freeContacts() override final { g_list_free(m_pContacts); m_pContacts = nullptr; diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx index f1d4f7dd8003..d6e70fdbee63 100644 --- a/connectivity/source/drivers/firebird/Connection.hxx +++ b/connectivity/source/drivers/firebird/Connection.hxx @@ -66,7 +66,7 @@ namespace connectivity typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector; typedef std::vector< css::uno::WeakReferenceHelper > OWeakRefArray; - class Connection : public Connection_BASE + class Connection final : public Connection_BASE { ::osl::Mutex m_aMutex; diff --git a/connectivity/source/inc/file/FConnection.hxx b/connectivity/source/inc/file/FConnection.hxx index 4041e060816f..e791e6ec3f07 100644 --- a/connectivity/source/inc/file/FConnection.hxx +++ b/connectivity/source/inc/file/FConnection.hxx @@ -90,7 +90,7 @@ namespace connectivity virtual sal_Bool SAL_CALL getAutoCommit( ) override; virtual void SAL_CALL commit( ) override; virtual void SAL_CALL rollback( ) override; - virtual sal_Bool SAL_CALL isClosed( ) override; + virtual sal_Bool SAL_CALL isClosed( ) override final; virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; virtual sal_Bool SAL_CALL isReadOnly( ) override; @@ -101,7 +101,7 @@ namespace connectivity virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; // XCloseable - virtual void SAL_CALL close( ) override; + virtual void SAL_CALL close( ) override final; // XWarningsSupplier virtual css::uno::Any SAL_CALL getWarnings( ) override; virtual void SAL_CALL clearWarnings( ) override; diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx index 61bc7f033775..71f3d3b95ff5 100644 --- a/connectivity/source/inc/file/FResultSet.hxx +++ b/connectivity/source/inc/file/FResultSet.hxx @@ -163,7 +163,7 @@ namespace connectivity OResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); // ::cppu::OComponentHelper - virtual void SAL_CALL disposing() override; + virtual void SAL_CALL disposing() override final; // XInterface virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; virtual void SAL_CALL acquire() throw() override; diff --git a/connectivity/source/inc/odbc/OConnection.hxx b/connectivity/source/inc/odbc/OConnection.hxx index 3cfda3792a8e..cb05d7373407 100644 --- a/connectivity/source/inc/odbc/OConnection.hxx +++ b/connectivity/source/inc/odbc/OConnection.hxx @@ -43,12 +43,10 @@ namespace connectivity typedef connectivity::OMetaConnection OConnection_BASE; typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector; - class OOO_DLLPUBLIC_ODBCBASE OConnection : + class OOO_DLLPUBLIC_ODBCBASE OConnection final : public OConnection_BASE, public OAutoRetrievingBase { - protected: - // Data attributes std::map< SQLHANDLE, rtl::Reference> m_aConnections; // holds all connections which are need for several statements -- cgit