sd/source/ui/framework/factories/BasicViewFactory.cxx | 11 +++++------ sd/source/ui/inc/framework/factories/BasicViewFactory.hxx | 2 +- sd/source/ui/slideshow/slideshowimpl.cxx | 4 ++-- sd/source/ui/slideshow/slideshowimpl.hxx | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-)
New commits: commit bf00c26bf189e9b69502be4e71e14f7619170af3 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Jun 30 13:34:20 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jul 1 09:37:01 2025 +0200 AnimationSlideController can be held by unique_ptr Change-Id: Idfdd2d3e97a3ef1b66691b27ab9eded56e2a9aae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187208 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index c5154f8e6203..ae24d94dcf6f 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -962,7 +962,7 @@ bool SlideshowImpl::startPreview( rtl::Reference< SdXImpressDocument > xDrawPages( mpDoc->getUnoModel() ); Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW ); - mpSlideController = std::make_shared<AnimationSlideController>( xSlides, AnimationSlideController::PREVIEW ); + mpSlideController = std::make_unique<AnimationSlideController>( xSlides, AnimationSlideController::PREVIEW ); sal_Int32 nSlideNumber = 0; Reference< XPropertySet > xSet( mxPreviewDrawPage, UNO_QUERY_THROW ); @@ -2515,7 +2515,7 @@ void SlideshowImpl::createSlideList( bool bAll, std::u16string_view rPresSlide ) rtl::Reference< SdXImpressDocument > xDrawPages( mpDoc->getUnoModel() ); Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW ); - mpSlideController = std::make_shared<AnimationSlideController>( xSlides, eMode ); + mpSlideController = std::make_unique<AnimationSlideController>( xSlides, eMode ); if( eMode != AnimationSlideController::CUSTOM ) { diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx index ef59951f0305..c0bbc1f9e72b 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -322,7 +322,7 @@ private: VclPtr<vcl::Window> mpParentWindow; VclPtr<sd::ShowWindow> mpShowWindow; - std::shared_ptr< AnimationSlideController > mpSlideController; + std::unique_ptr< AnimationSlideController > mpSlideController; ::tools::Long mnRestoreSlide; Point maPopupMousePos; commit dfb5460e478d77cdd62486550dcbec6d80b3b541 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Jun 30 13:30:13 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jul 1 09:36:52 2025 +0200 no need to hold ViewCache by shared_ptr Change-Id: If147e32352c1c22334426c2bf91f5351bfbe2e8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187207 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 17070d4ef609..4882b5415b01 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -72,7 +72,6 @@ BasicViewFactory::BasicViewFactory (const rtl::Reference<::sd::DrawController>& : mpBase(nullptr), mpFrameView(nullptr), mpWindow(VclPtr<WorkWindow>::Create(nullptr,WB_STDWORK)), - mpViewCache(std::make_shared<ViewCache>()), mxLocalPane(new Pane(rtl::Reference<ResourceId>(), mpWindow.get())) { try @@ -116,7 +115,7 @@ void BasicViewFactory::disposing(std::unique_lock<std::mutex>&) } // Release the view cache. - for (const auto& rxView : *mpViewCache) + for (const auto& rxView : maViewCache) { ReleaseView(rxView, true); } @@ -363,7 +362,7 @@ void BasicViewFactory::ReleaseView ( { if (mxLocalPane.is()) if (rpDescriptor->mxView->relocateToAnchor(mxLocalPane)) - mpViewCache->push_back(rpDescriptor); + maViewCache.push_back(rpDescriptor); else bIsCacheable = false; else @@ -420,12 +419,12 @@ std::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::GetViewFromC std::shared_ptr<ViewDescriptor> pDescriptor; // Search for the requested view in the cache. - ViewCache::iterator iEntry = std::find_if(mpViewCache->begin(), mpViewCache->end(), + ViewCache::iterator iEntry = std::find_if(maViewCache.begin(), maViewCache.end(), [&rxViewId](const ViewCache::value_type& rxEntry) { return rxEntry->mxViewId->compareTo(rxViewId) == 0; }); - if (iEntry != mpViewCache->end()) + if (iEntry != maViewCache.end()) { pDescriptor = *iEntry; - mpViewCache->erase(iEntry); + maViewCache.erase(iEntry); } // When the view has been found then relocate it to the given pane and diff --git a/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx index f2995ea41b6f..f70ac3aa1cdb 100644 --- a/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx +++ b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx @@ -77,7 +77,7 @@ private: using ViewCache = std::vector<std::shared_ptr<ViewDescriptor>>; ScopedVclPtr<vcl::Window> mpWindow; - std::shared_ptr<ViewCache> mpViewCache; + ViewCache maViewCache; rtl::Reference<framework::AbstractPane> mxLocalPane;