sd/source/ui/framework/factories/BasicViewFactory.cxx     |   33 +++-----------
 sd/source/ui/inc/framework/factories/BasicViewFactory.hxx |    6 +-
 2 files changed, 11 insertions(+), 28 deletions(-)

New commits:
commit e646709be8f39f25471d2ebc253006e9958d20f1
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri May 16 08:54:09 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri May 16 20:16:25 2025 +0200

    sd: Don't use unique_ptr for BasicViewFactory::mpViewShellContainer
    
    There's no particular reason for it, so just use a simple
    std::vector.
    
    Change-Id: I5d63860184081065e218c994b311a96deacf1208
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185380
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx 
b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index 34a13b79ad5e..d7cb8fe65f47 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -68,8 +68,7 @@ public:
 //===== ViewFactory ===========================================================
 
 BasicViewFactory::BasicViewFactory (const 
rtl::Reference<::sd::DrawController>& rxController)
-    : mpViewShellContainer(new ViewShellContainer),
-      mpBase(nullptr),
+    : mpBase(nullptr),
       mpFrameView(nullptr),
       mpWindow(VclPtr<WorkWindow>::Create(nullptr,WB_STDWORK)),
       mpViewCache(std::make_shared<ViewCache>()),
@@ -126,11 +125,11 @@ void 
BasicViewFactory::disposing(std::unique_lock<std::mutex>&)
     // trivial requirement, because no one other than us holds a shared
     // pointer).
     //    ViewShellContainer::const_iterator iView;
-    for (const auto& rxView : *mpViewShellContainer)
+    for (const auto& rxView : maViewShellContainer)
     {
         OSL_ASSERT(rxView->mpViewShell.use_count() == 1);
     }
-    mpViewShellContainer.reset();
+    maViewShellContainer.clear();
 }
 
 Reference<XResource> SAL_CALL BasicViewFactory::createResource (
@@ -170,7 +169,7 @@ Reference<XResource> SAL_CALL 
BasicViewFactory::createResource (
 
     rtl::Reference<ViewShellWrapper> xView = pDescriptor->mxView;
 
-    mpViewShellContainer->push_back(pDescriptor);
+    maViewShellContainer.push_back(pDescriptor);
 
     if (bIsCenterPane)
         ActivateCenterView(pDescriptor);
@@ -190,12 +189,12 @@ void SAL_CALL BasicViewFactory::releaseResource (const 
Reference<XResource>& rxV
 
     ViewShellContainer::iterator iViewShell (
         ::std::find_if(
-            mpViewShellContainer->begin(),
-            mpViewShellContainer->end(),
+            maViewShellContainer.begin(),
+            maViewShellContainer.end(),
             [&] (std::shared_ptr<ViewDescriptor> const& pVD) {
                 return ViewDescriptor::CompareView(pVD, rxView);
             } ));
-    if (iViewShell == mpViewShellContainer->end())
+    if (iViewShell == maViewShellContainer.end())
     {
         throw lang::IllegalArgumentException();
     }
@@ -227,7 +226,7 @@ void SAL_CALL BasicViewFactory::releaseResource (const 
Reference<XResource>& rxV
 
     ReleaseView(*iViewShell, false);
 
-    mpViewShellContainer->erase(iViewShell);
+    maViewShellContainer.erase(iViewShell);
 }
 
 std::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::CreateView 
(
diff --git a/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx 
b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx
index 106823221455..f084eb41e1ac 100644
--- a/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx
+++ b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx
@@ -81,7 +81,7 @@ private:
         mxConfigurationController;
     class ViewDescriptor;
     using ViewShellContainer = std::vector<std::shared_ptr<ViewDescriptor>>;
-    std::unique_ptr<ViewShellContainer> mpViewShellContainer;
+    ViewShellContainer maViewShellContainer;
     ViewShellBase* mpBase;
     FrameView* mpFrameView;
 
commit 8dd542fbfa9a21c2b89533a1566cca89a271afe8
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri May 16 08:31:03 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri May 16 20:16:17 2025 +0200

    sd: Turn 2 vector subclasses into aliases
    
    They don't add any extra functionality, so no need
    to subclass std::vector instead of just using it.
    
    Also address
    
        
/home/michi/development/git/libreoffice/sd/source/ui/framework/factories/BasicViewFactory.cxx:71:28:
 error: if zero-initialization of 'ViewShellContainer' (aka 
'vector<std::shared_ptr<ViewDescriptor>>') is intentional here, better make 
that more explicit (e.g., assigning to members, default constructor, default 
member initializers, std::memset) [loplugin:subtlezeroinit]
           71 |     : mpViewShellContainer(new ViewShellContainer()),
              |                            ^~~~~~~~~~~~~~~~~~~~~~~~
        1 error generated.
    
    Change-Id: Ia58b669e61d1350b1742dbc8e86339fb64f22c03
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185379
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx 
b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index 1d7db09c547c..34a13b79ad5e 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -65,26 +65,10 @@ public:
     { return rpDescriptor->mxView.get() == rxView.get(); }
 };
 
-//===== BasicViewFactory::ViewShellContainer ==================================
-
-class BasicViewFactory::ViewShellContainer
-    : public ::std::vector<std::shared_ptr<ViewDescriptor> >
-{
-public:
-    ViewShellContainer() {};
-};
-
-class BasicViewFactory::ViewCache
-    : public ::std::vector<std::shared_ptr<ViewDescriptor> >
-{
-public:
-    ViewCache() {};
-};
-
 //===== ViewFactory ===========================================================
 
 BasicViewFactory::BasicViewFactory (const 
rtl::Reference<::sd::DrawController>& rxController)
-    : mpViewShellContainer(new ViewShellContainer()),
+    : mpViewShellContainer(new ViewShellContainer),
       mpBase(nullptr),
       mpFrameView(nullptr),
       mpWindow(VclPtr<WorkWindow>::Create(nullptr,WB_STDWORK)),
diff --git a/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx 
b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx
index 8cc0a7bfba06..106823221455 100644
--- a/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx
+++ b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx
@@ -80,12 +80,12 @@ private:
     css::uno::Reference<css::drawing::framework::XConfigurationController>
         mxConfigurationController;
     class ViewDescriptor;
-    class ViewShellContainer;
+    using ViewShellContainer = std::vector<std::shared_ptr<ViewDescriptor>>;
     std::unique_ptr<ViewShellContainer> mpViewShellContainer;
     ViewShellBase* mpBase;
     FrameView* mpFrameView;
 
-    class ViewCache;
+    using ViewCache = std::vector<std::shared_ptr<ViewDescriptor>>;
     ScopedVclPtr<vcl::Window> mpWindow;
     std::shared_ptr<ViewCache> mpViewCache;
 

Reply via email to