[Libreoffice-commits] core.git: sfx2/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 31 17:57:18 UTC 2021


 sfx2/source/appl/appdata.cxx |    4 ++--
 sfx2/source/inc/appdata.hxx  |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 1969673c42880419be95425eef792893692878a9
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Aug 30 21:55:50 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 31 19:56:42 2021 +0200

    no need to allocate SfxDocumentTemplates separately
    
    it only contains a single pointer
    
    Change-Id: If6fc4924b7980317500a5c02e62c671f8f97aafd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121338
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index 2dbe419c5911..9f6e09267858 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -108,10 +108,10 @@ SfxAppData_Impl::~SfxAppData_Impl()
 SfxDocumentTemplates* SfxAppData_Impl::GetDocumentTemplates()
 {
     if ( !pTemplates )
-        pTemplates.reset(new SfxDocumentTemplates);
+        pTemplates.emplace();
     else
         pTemplates->ReInitFromComponent();
-    return pTemplates.get();
+    return &*pTemplates;
 }
 
 void SfxAppData_Impl::OnApplicationBasicManagerCreated( BasicManager& _rBasicManager )
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index 89ccc6b0b982..9966981241aa 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -26,6 +26,7 @@
 #include <svl/svdde.hxx>
 #include <svtools/ehdl.hxx>
 #include <sfx2/app.hxx>
+#include <sfx2/doctempl.hxx>
 #include <o3tl/enumarray.hxx>
 
 #include <bitset.hxx>
@@ -43,7 +44,6 @@ class ISfxTemplateCommon;
 class SfxFilterMatcher;
 class SfxStatusDispatcher;
 class SfxDdeTriggerTopic_Impl;
-class SfxDocumentTemplates;
 class SfxFrame;
 class SfxViewFrame;
 class SfxSlotPool;
@@ -83,7 +83,7 @@ public:
 #endif
     rtl::Reference<SfxStatusDispatcher> mxAppDispatch;
     std::unique_ptr<SfxPickList>        mxAppPickList;
-    std::unique_ptr<SfxDocumentTemplates> pTemplates;
+    std::optional<SfxDocumentTemplates> pTemplates;
 
     // global pointers
     SfxItemPool*                        pPool;


More information about the Libreoffice-commits mailing list