svx/inc/galleryfilestorageentry.hxx             |   15 ++++++++-------
 svx/source/gallery2/gallery1.cxx                |    2 +-
 svx/source/gallery2/galleryfilestorageentry.cxx |    9 +++------
 3 files changed, 12 insertions(+), 14 deletions(-)

New commits:
commit 4f520dc7e3badc0165ee3b13ddd514bb94b00265
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon May 8 13:00:26 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue May 9 18:12:02 2023 +0200

    inline GalleryStorageLocations allocation into GalleryFileStorageEntry
    
    no need to allocate this separately
    
    Change-Id: I01795ac459c5b65b5c143dc081e5b7cf74c2e6f4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151554
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/svx/inc/galleryfilestorageentry.hxx 
b/svx/inc/galleryfilestorageentry.hxx
index 66762fa82241..10a020297e72 100644
--- a/svx/inc/galleryfilestorageentry.hxx
+++ b/svx/inc/galleryfilestorageentry.hxx
@@ -30,7 +30,7 @@ class GalleryObjectCollection;
 class GalleryFileStorageEntry final
 {
 private:
-    std::unique_ptr<GalleryStorageLocations> mpGalleryStorageLocations;
+    GalleryStorageLocations maGalleryStorageLocations;
 
 public:
     GalleryFileStorageEntry();
@@ -38,15 +38,16 @@ public:
 
     OUString ReadStrFromIni(std::u16string_view aKeyName) const;
 
-    const INetURLObject& GetThmURL() const { return 
mpGalleryStorageLocations->GetThmURL(); }
-    const INetURLObject& GetSdgURL() const { return 
mpGalleryStorageLocations->GetSdgURL(); }
-    const INetURLObject& GetSdvURL() const { return 
mpGalleryStorageLocations->GetSdvURL(); }
-    const INetURLObject& GetStrURL() const { return 
mpGalleryStorageLocations->GetStrURL(); }
+    const INetURLObject& GetThmURL() const { return 
maGalleryStorageLocations.GetThmURL(); }
+    const INetURLObject& GetSdgURL() const { return 
maGalleryStorageLocations.GetSdgURL(); }
+    const INetURLObject& GetSdvURL() const { return 
maGalleryStorageLocations.GetSdvURL(); }
+    const INetURLObject& GetStrURL() const { return 
maGalleryStorageLocations.GetStrURL(); }
 
-    const std::unique_ptr<GalleryStorageLocations>& 
getGalleryStorageLocations() const
+    const GalleryStorageLocations& getGalleryStorageLocations() const
     {
-        return mpGalleryStorageLocations;
+        return maGalleryStorageLocations;
     }
+    GalleryStorageLocations& getGalleryStorageLocations() { return 
maGalleryStorageLocations; }
 
     static GalleryThemeEntry* CreateThemeEntry(const INetURLObject& rURL, bool 
bReadOnly);
 
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
index 8dad889b6a8c..17bc19a8990a 100644
--- a/svx/source/gallery2/gallery1.cxx
+++ b/svx/source/gallery2/gallery1.cxx
@@ -726,7 +726,7 @@ bool GalleryThemeEntry::IsDefault() const
 
 GalleryStorageLocations& GalleryThemeEntry::getGalleryStorageLocations() const
 {
-    return *mpGalleryStorageEngineEntry->getGalleryStorageLocations();
+    return mpGalleryStorageEngineEntry->getGalleryStorageLocations();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/galleryfilestorageentry.cxx 
b/svx/source/gallery2/galleryfilestorageentry.cxx
index b7de500f66e3..593396aaed37 100644
--- a/svx/source/gallery2/galleryfilestorageentry.cxx
+++ b/svx/source/gallery2/galleryfilestorageentry.cxx
@@ -35,20 +35,17 @@ static bool FileExists(const INetURLObject& rURL, 
std::u16string_view rExt)
     return FileExists(aURL);
 }
 
-GalleryFileStorageEntry::GalleryFileStorageEntry()
-{
-    mpGalleryStorageLocations = std::make_unique<GalleryStorageLocations>();
-}
+GalleryFileStorageEntry::GalleryFileStorageEntry() {}
 
 void GalleryFileStorageEntry::setStorageLocations(INetURLObject& rURL)
 {
-    mpGalleryStorageLocations->SetStorageLocations(rURL);
+    maGalleryStorageLocations.SetStorageLocations(rURL);
 }
 
 std::unique_ptr<GalleryFileStorage> 
GalleryFileStorageEntry::createGalleryStorageEngine(
     GalleryObjectCollection& mrGalleryObjectCollection, bool& bReadOnly)
 {
-    return std::make_unique<GalleryFileStorage>(*mpGalleryStorageLocations,
+    return std::make_unique<GalleryFileStorage>(maGalleryStorageLocations,
                                                 mrGalleryObjectCollection, 
bReadOnly);
 }
 

Reply via email to