summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-21 10:45:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-25 09:12:38 +0200
commitb9426828aefad95aace7f8935ef5dbd6a4664091 (patch)
tree75ae6d23c3fa5efcf77d64deb84041e28edf758d /desktop
parentf287292d91012519782f0b7a698449b5eeb624b9 (diff)
loplugin:useuniqueptr in desktop
Change-Id: Iff29d7d5962b441678c91bcd0319ac07c6488b34 Reviewed-on: https://gerrit.libreoffice.org/56327 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/deployment/gui/dp_gui_extlistbox.cxx12
-rw-r--r--desktop/source/deployment/gui/dp_gui_extlistbox.hxx4
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.cxx22
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.hxx4
4 files changed, 18 insertions, 24 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 60bc41d003e5..5df9f5574093 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -224,8 +224,8 @@ void ExtensionBox_Impl::Init()
m_xRemoveListener = new ExtensionRemovedListener( this );
- m_pLocale = new lang::Locale( Application::GetSettings().GetLanguageTag().getLocale() );
- m_pCollator = new CollatorWrapper( ::comphelper::getProcessComponentContext() );
+ m_pLocale.reset( new lang::Locale( Application::GetSettings().GetLanguageTag().getLocale() ) );
+ m_pCollator.reset( new CollatorWrapper( ::comphelper::getProcessComponentContext() ) );
m_pCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
Show();
@@ -256,8 +256,8 @@ void ExtensionBox_Impl::dispose()
m_xRemoveListener.clear();
- delete m_pLocale;
- delete m_pCollator;
+ m_pLocale.reset();
+ m_pCollator.reset();
::svt::IExtensionListBox::dispose();
}
@@ -841,7 +841,7 @@ bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl& rEntry, const long nSta
if ( nStart == nEnd )
{
- eCompare = rEntry->CompareTo( m_pCollator, m_vEntries[ nStart ] );
+ eCompare = rEntry->CompareTo( m_pCollator.get(), m_vEntries[ nStart ] );
if ( eCompare < 0 )
return false;
else if ( eCompare == 0 )
@@ -862,7 +862,7 @@ bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl& rEntry, const long nSta
}
const long nMid = nStart + ( ( nEnd - nStart ) / 2 );
- eCompare = rEntry->CompareTo( m_pCollator, m_vEntries[ nMid ] );
+ eCompare = rEntry->CompareTo( m_pCollator.get(), m_vEntries[ nMid ] );
if ( eCompare < 0 )
return FindEntryPos( rEntry, nStart, nMid-1, nPos );
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
index 8a2ede5822ca..356a4ff2e238 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
@@ -140,8 +140,8 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox
std::vector< TEntry_Impl > m_vEntries;
std::vector< TEntry_Impl > m_vRemovedEntries;
- css::lang::Locale *m_pLocale;
- CollatorWrapper *m_pCollator;
+ std::unique_ptr<css::lang::Locale> m_pLocale;
+ std::unique_ptr<CollatorWrapper> m_pCollator;
//Holds weak references to extensions to which is we have added an XEventListener
std::vector< css::uno::WeakReference<
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 37513af9e031..852addaaa829 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -548,14 +548,8 @@ void UpdateDialog::dispose()
{
storeIgnoredUpdates();
- for (auto const& listboxEntry : m_ListboxEntries)
- {
- delete listboxEntry;
- }
- for (auto const& ignoredUpdate : m_ignoredUpdates)
- {
- delete ignoredUpdate;
- }
+ m_ListboxEntries.clear();
+ m_ignoredUpdates.clear();
m_pUpdates.disposeAndClear();
m_pchecking.clear();
m_pthrobber.clear();
@@ -719,7 +713,7 @@ void UpdateDialog::addEnabledUpdate( OUString const & name,
UpdateDialog::Index *pEntry = new UpdateDialog::Index( ENABLED_UPDATE, nIndex, name );
m_enabledUpdates.push_back( data );
- m_ListboxEntries.push_back( pEntry );
+ m_ListboxEntries.emplace_back( pEntry );
if ( ! isIgnoredUpdate( pEntry ) )
{
@@ -742,7 +736,7 @@ void UpdateDialog::addDisabledUpdate( UpdateDialog::DisabledUpdate const & data
UpdateDialog::Index *pEntry = new UpdateDialog::Index( DISABLED_UPDATE, nIndex, data.name );
m_disabledUpdates.push_back( data );
- m_ListboxEntries.push_back( pEntry );
+ m_ListboxEntries.emplace_back( pEntry );
isIgnoredUpdate( pEntry );
addAdditional( pEntry, SvLBoxButtonKind::DisabledCheckbox );
@@ -755,7 +749,7 @@ void UpdateDialog::addSpecificError( UpdateDialog::SpecificError const & data )
UpdateDialog::Index *pEntry = new UpdateDialog::Index( SPECIFIC_ERROR, nIndex, data.name );
m_specificErrors.push_back( data );
- m_ListboxEntries.push_back( pEntry );
+ m_ListboxEntries.emplace_back( pEntry );
addAdditional( pEntry, SvLBoxButtonKind::StaticImage);
}
@@ -976,7 +970,7 @@ void UpdateDialog::getIgnoredUpdates()
uno::Any aPropValue( uno::Reference< beans::XPropertySet >( xNameAccess->getByName( aIdentifier ), uno::UNO_QUERY_THROW )->getPropertyValue( PROPERTY_VERSION ) );
aPropValue >>= aVersion;
IgnoredUpdate *pData = new IgnoredUpdate( aIdentifier, aVersion );
- m_ignoredUpdates.push_back( pData );
+ m_ignoredUpdates.emplace_back( pData );
}
}
@@ -1106,7 +1100,7 @@ void UpdateDialog::setIgnoredUpdate( UpdateDialog::Index const *pIndex, bool bIg
if ( bIgnore && !bFound )
{
IgnoredUpdate *pData = new IgnoredUpdate( aExtensionID, aVersion );
- m_ignoredUpdates.push_back( pData );
+ m_ignoredUpdates.emplace_back( pData );
}
}
}
@@ -1222,7 +1216,7 @@ IMPL_LINK_NOARG(UpdateDialog, allHandler, CheckBox&, void)
for (auto const& listboxEntry : m_ListboxEntries)
{
if ( listboxEntry->m_bIgnored || ( listboxEntry->m_eKind != ENABLED_UPDATE ) )
- insertItem( listboxEntry, SvLBoxButtonKind::DisabledCheckbox );
+ insertItem( listboxEntry.get(), SvLBoxButtonKind::DisabledCheckbox );
}
}
else
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
index 5e83051f9ddd..6116ca95ee71 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
@@ -194,8 +194,8 @@ private:
std::vector< dp_gui::UpdateData > m_enabledUpdates;
std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates;
std::vector< UpdateDialog::SpecificError > m_specificErrors;
- std::vector< UpdateDialog::IgnoredUpdate* > m_ignoredUpdates;
- std::vector< Index* > m_ListboxEntries;
+ std::vector< std::unique_ptr<UpdateDialog::IgnoredUpdate> > m_ignoredUpdates;
+ std::vector< std::unique_ptr<Index> > m_ListboxEntries;
std::vector< dp_gui::UpdateData > & m_updateData;
rtl::Reference< UpdateDialog::Thread > m_thread;
css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager;