include/svx/shapepropertynotifier.hxx | 4 ++-- svx/source/unodraw/shapepropertynotifier.cxx | 4 ++-- svx/source/unodraw/unoshape.cxx | 4 ++-- sw/source/core/unocore/unodraw.cxx | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-)
New commits: commit 1db6e8b7760de1abd49d62df230d89480ffd2161 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 10 16:02:48 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Feb 10 17:20:19 2022 +0100 no need to use shared_ptr in PropertyChangeNotifier these things are never shared Change-Id: I21c3b7cf2abf6e47a8839ac60e7bf27b7282ed76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129784 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/svx/shapepropertynotifier.hxx b/include/svx/shapepropertynotifier.hxx index b26525c63f7b..779eb66e9485 100644 --- a/include/svx/shapepropertynotifier.hxx +++ b/include/svx/shapepropertynotifier.hxx @@ -113,7 +113,7 @@ namespace svx /** registers an IPropertyValueProvider */ - void registerProvider( const ShapeProperty _eProperty, const std::shared_ptr<IPropertyValueProvider>& _rProvider ); + void registerProvider( const ShapeProperty _eProperty, std::unique_ptr<IPropertyValueProvider> _rProvider ); /** notifies changes in the given property to all registered listeners @@ -137,7 +137,7 @@ namespace svx return size_t( x ); } }; - typedef std::unordered_map< ShapeProperty, std::shared_ptr<IPropertyValueProvider>, ShapePropertyHash > + typedef std::unordered_map< ShapeProperty, std::unique_ptr<IPropertyValueProvider>, ShapePropertyHash > PropertyProviders; ::cppu::OWeakObject& m_rContext; PropertyProviders m_aProviders; diff --git a/svx/source/unodraw/shapepropertynotifier.cxx b/svx/source/unodraw/shapepropertynotifier.cxx index 9151190c0cda..6b2262e044f1 100644 --- a/svx/source/unodraw/shapepropertynotifier.cxx +++ b/svx/source/unodraw/shapepropertynotifier.cxx @@ -76,14 +76,14 @@ namespace svx { } - void PropertyChangeNotifier::registerProvider(const ShapeProperty _eProperty, const std::shared_ptr<IPropertyValueProvider>& _rProvider) + void PropertyChangeNotifier::registerProvider(const ShapeProperty _eProperty, std::unique_ptr<IPropertyValueProvider> _rProvider) { ENSURE_OR_THROW( !!_rProvider, "NULL factory not allowed." ); OSL_ENSURE( m_aProviders.find( _eProperty ) == m_aProviders.end(), "PropertyChangeNotifier::registerProvider: factory for this ID already present!" ); - m_aProviders[ _eProperty ] = _rProvider; + m_aProviders.emplace( _eProperty, std::move(_rProvider)); } void PropertyChangeNotifier::notifyPropertyChange( const ShapeProperty _eProperty ) const diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 4081e4d8128f..cb0aa12afd9a 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -325,9 +325,9 @@ svx::PropertyChangeNotifier& SvxShape::getShapePropertyChangeNotifier() void SvxShape::impl_construct() { mpImpl->maPropertyNotifier.registerProvider( svx::ShapeProperty::Position, - std::make_shared<ShapePositionProvider>( *mpImpl ) ); + std::make_unique<ShapePositionProvider>( *mpImpl ) ); mpImpl->maPropertyNotifier.registerProvider( svx::ShapeProperty::Size, - std::make_shared<ShapeSizeProvider>( *mpImpl ) ); + std::make_unique<ShapeSizeProvider>( *mpImpl ) ); if ( HasSdrObject() ) { diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 66deb6769321..31efe7812410 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -865,8 +865,8 @@ namespace { void lcl_addShapePropertyEventFactories( SdrObject& _rObj, SwXShape& _rShape ) { - auto pProvider = std::make_shared<svx::PropertyValueProvider>( _rShape, "AnchorType" ); - _rObj.getShapePropertyChangeNotifier().registerProvider( svx::ShapeProperty::TextDocAnchor, pProvider ); + auto pProvider = std::make_unique<svx::PropertyValueProvider>( _rShape, "AnchorType" ); + _rObj.getShapePropertyChangeNotifier().registerProvider( svx::ShapeProperty::TextDocAnchor, std::move(pProvider) ); } }