diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-02-26 20:37:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-27 05:43:11 +0000 |
commit | 09680fadbcd85da3405cefeed66712bc0ba2be9c (patch) | |
tree | 56e32ecc03bf9f4e3a484af5150bc58abeae3fb6 /desktop | |
parent | 44a3085f9aaf0dfc62b1a8f34d3b8889d69c4e62 (diff) |
no need to hold CollatorWrapper by std::unique_ptr
allocate it inline, it is only one pointer in size
Change-Id: Idb6217e6c9c37da92427aa6c497223a84015c553
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147742
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.cxx | 10 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_extlistbox.hxx | 3 |
2 files changed, 7 insertions, 6 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index d30d24f79166..f21585c3e402 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -220,8 +220,8 @@ void ExtensionBox_Impl::Init() m_xRemoveListener = new ExtensionRemovedListener( this ); 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 ); + m_oCollator.emplace( ::comphelper::getProcessComponentContext() ); + m_oCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE ); } ExtensionBox_Impl::~ExtensionBox_Impl() @@ -241,7 +241,7 @@ ExtensionBox_Impl::~ExtensionBox_Impl() m_xRemoveListener.clear(); m_pLocale.reset(); - m_pCollator.reset(); + m_oCollator.reset(); } sal_Int32 ExtensionBox_Impl::getItemCount() const @@ -826,7 +826,7 @@ bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl& rEntry, const tools::Lo if ( nStart == nEnd ) { - eCompare = rEntry->CompareTo( m_pCollator.get(), m_vEntries[ nStart ] ); + eCompare = rEntry->CompareTo( &*m_oCollator, m_vEntries[ nStart ] ); if ( eCompare < 0 ) return false; else if ( eCompare == 0 ) @@ -847,7 +847,7 @@ bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl& rEntry, const tools::Lo } const tools::Long nMid = nStart + ( ( nEnd - nStart ) / 2 ); - eCompare = rEntry->CompareTo( m_pCollator.get(), m_vEntries[ nMid ] ); + eCompare = rEntry->CompareTo( &*m_oCollator, 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 d706975dcdfd..cfc04f115d22 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -33,6 +33,7 @@ #include <com/sun/star/deployment/XPackage.hpp> #include <memory> +#include <optional> #include "dp_gui.h" @@ -137,7 +138,7 @@ class ExtensionBox_Impl : public weld::CustomWidgetController std::vector< TEntry_Impl > m_vRemovedEntries; std::unique_ptr<css::lang::Locale> m_pLocale; - std::unique_ptr<CollatorWrapper> m_pCollator; + std::optional<CollatorWrapper> m_oCollator; //Holds weak references to extensions to which is we have added an XEventListener std::vector< css::uno::WeakReference< |