diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-11 14:09:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-15 08:38:44 +0200 |
commit | 2088dac08b729805e981465526be3aad090462f0 (patch) | |
tree | 4fe95cf36179dfa15df8ea8e95b4a132e24f086e /dbaccess | |
parent | 3d5fde2064c4c63797ba03269cd405096a2dba04 (diff) |
loplugin:useuniqueptr in ODbAdminDialog
Change-Id: I4487552b2936cdfcc38055bf16e114fb6b54a3ed
Reviewed-on: https://gerrit.libreoffice.org/59013
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/dlg/dbadmin.cxx | 14 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dbadmin.hxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/unoadmin.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/DBTypeWizDlg.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/TableFilterDlg.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/UserSettingsDlg.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/admindlg.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/unoadmin.cxx | 1 |
10 files changed, 13 insertions, 20 deletions
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index 3cfdc343d6ef..5075f47c4a37 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -286,7 +286,7 @@ void ODbAdminDialog::clearPassword() m_pImpl->clearPassword(); } -SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection) +void ODbAdminDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection) { // just to be sure .... _rpSet = nullptr; @@ -431,19 +431,13 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp _rpPool->FreezeIdRanges(); // and, finally, the set - _rpSet = new SfxItemSet(*_rpPool); - - return _rpSet; + _rpSet.reset(new SfxItemSet(*_rpPool)); } -void ODbAdminDialog::destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults) +void ODbAdminDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults) { // _first_ delete the set (referring the pool) - if (_rpSet) - { - delete _rpSet; - _rpSet = nullptr; - } + _rpSet.reset(); // delete the pool if (_rpPool) diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx index 2bad2aaaba57..65ff82a197fb 100644 --- a/dbaccess/source/ui/inc/dbadmin.hxx +++ b/dbaccess/source/ui/inc/dbadmin.hxx @@ -69,10 +69,10 @@ public: @param _pTypeCollection pointer to an <type>ODatasourceMap</type>. May be NULL, in this case the pool will not contain a typecollection default. */ - static SfxItemSet* createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection); + static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection); /** destroy and item set / item pool / pool defaults previously created by <method>createItemSet</method> */ - static void destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults); + static void destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults); /** selects the DataSource @param _rName diff --git a/dbaccess/source/ui/inc/unoadmin.hxx b/dbaccess/source/ui/inc/unoadmin.hxx index 9cd0163046db..8f9013d4d27b 100644 --- a/dbaccess/source/ui/inc/unoadmin.hxx +++ b/dbaccess/source/ui/inc/unoadmin.hxx @@ -37,7 +37,7 @@ class ODatabaseAdministrationDialog :public ODatabaseAdministrationDialogBase { protected: - SfxItemSet* m_pDatasourceItems; // item set for the dialog + std::unique_ptr<SfxItemSet> m_pDatasourceItems; // item set for the dialog SfxItemPool* m_pItemPool; // item pool for the item set for the dialog std::vector<SfxPoolItem*>* m_pItemPoolDefaults; // pool defaults diff --git a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx index 4b361e5ef3e6..9166f0a5c10c 100644 --- a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx +++ b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx @@ -124,7 +124,7 @@ namespace dbaui svt::OGenericUnoDialog::Dialog OAdvancedSettingsDialog::createDialog(vcl::Window* _pParent) { - return svt::OGenericUnoDialog::Dialog(VclPtr<AdvancedSettingsDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection)); + return svt::OGenericUnoDialog::Dialog(VclPtr<AdvancedSettingsDialog>::Create(_pParent, m_pDatasourceItems.get(), m_aContext, m_aInitialSelection)); } } // namespace dbaui diff --git a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx index e9f007905ff9..51c075f9d263 100644 --- a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx +++ b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx @@ -93,7 +93,7 @@ Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialog::getPropertySetInfo() svt::OGenericUnoDialog::Dialog ODBTypeWizDialog::createDialog(vcl::Window* _pParent) { - return svt::OGenericUnoDialog::Dialog(VclPtr<ODbTypeWizDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection)); + return svt::OGenericUnoDialog::Dialog(VclPtr<ODbTypeWizDialog>::Create(_pParent, m_pDatasourceItems.get(), m_aContext, m_aInitialSelection)); } } // namespace dbaui diff --git a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx index 645736285d8e..6f7cb96026ea 100644 --- a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx +++ b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx @@ -106,7 +106,7 @@ Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialogSetup::getPropertySetInfo( svt::OGenericUnoDialog::Dialog ODBTypeWizDialogSetup::createDialog(vcl::Window* _pParent) { - return svt::OGenericUnoDialog::Dialog(VclPtr<ODbTypeWizDialogSetup>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection)); + return svt::OGenericUnoDialog::Dialog(VclPtr<ODbTypeWizDialogSetup>::Create(_pParent, m_pDatasourceItems.get(), m_aContext, m_aInitialSelection)); } void ODBTypeWizDialogSetup::executedDialog(sal_Int16 _nExecutionResult) diff --git a/dbaccess/source/ui/uno/TableFilterDlg.cxx b/dbaccess/source/ui/uno/TableFilterDlg.cxx index 4a6ef4cf6c3c..b749e9cb573c 100644 --- a/dbaccess/source/ui/uno/TableFilterDlg.cxx +++ b/dbaccess/source/ui/uno/TableFilterDlg.cxx @@ -93,7 +93,7 @@ Reference<XPropertySetInfo> SAL_CALL OTableFilterDialog::getPropertySetInfo() svt::OGenericUnoDialog::Dialog OTableFilterDialog::createDialog(vcl::Window* _pParent) { - return svt::OGenericUnoDialog::Dialog(VclPtr<OTableSubscriptionDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection)); + return svt::OGenericUnoDialog::Dialog(VclPtr<OTableSubscriptionDialog>::Create(_pParent, m_pDatasourceItems.get(), m_aContext, m_aInitialSelection)); } } // namespace dbaui diff --git a/dbaccess/source/ui/uno/UserSettingsDlg.cxx b/dbaccess/source/ui/uno/UserSettingsDlg.cxx index f2aa0681e68b..9dac195f4bd4 100644 --- a/dbaccess/source/ui/uno/UserSettingsDlg.cxx +++ b/dbaccess/source/ui/uno/UserSettingsDlg.cxx @@ -93,7 +93,7 @@ Reference<XPropertySetInfo> SAL_CALL OUserSettingsDialog::getPropertySetInfo() svt::OGenericUnoDialog::Dialog OUserSettingsDialog::createDialog(vcl::Window* _pParent) { - return svt::OGenericUnoDialog::Dialog(VclPtr<OUserAdminDlg>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection, m_xActiveConnection)); + return svt::OGenericUnoDialog::Dialog(VclPtr<OUserAdminDlg>::Create(_pParent, m_pDatasourceItems.get(), m_aContext, m_aInitialSelection, m_xActiveConnection)); } } // namespace dbaui diff --git a/dbaccess/source/ui/uno/admindlg.cxx b/dbaccess/source/ui/uno/admindlg.cxx index c58afd44919e..a711537e1a4c 100644 --- a/dbaccess/source/ui/uno/admindlg.cxx +++ b/dbaccess/source/ui/uno/admindlg.cxx @@ -93,7 +93,7 @@ Reference<XPropertySetInfo> SAL_CALL ODataSourcePropertyDialog::getPropertySetI svt::OGenericUnoDialog::Dialog ODataSourcePropertyDialog::createDialog(vcl::Window* _pParent) { - VclPtrInstance<ODbAdminDialog> pDialog(_pParent, m_pDatasourceItems, m_aContext); + VclPtrInstance<ODbAdminDialog> pDialog(_pParent, m_pDatasourceItems.get(), m_aContext); // the initial selection if ( m_aInitialSelection.hasValue() ) diff --git a/dbaccess/source/ui/uno/unoadmin.cxx b/dbaccess/source/ui/uno/unoadmin.cxx index c19e4d09c9f3..b5039b6e542c 100644 --- a/dbaccess/source/ui/uno/unoadmin.cxx +++ b/dbaccess/source/ui/uno/unoadmin.cxx @@ -38,7 +38,6 @@ namespace dbaui ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XComponentContext >& _rxORB) :ODatabaseAdministrationDialogBase(_rxORB) - ,m_pDatasourceItems(nullptr) ,m_pItemPool(nullptr) ,m_pItemPoolDefaults(nullptr) { |