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

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


 sfx2/source/appl/app.cxx     |    2 +-
 sfx2/source/appl/appinit.cxx |   16 ++++++++--------
 sfx2/source/appl/appmisc.cxx |    2 +-
 sfx2/source/inc/appdata.hxx  |   15 +++++++--------
 4 files changed, 17 insertions(+), 18 deletions(-)

New commits:
commit a41cbb1212a92f525dc75e90007c6dbc998f37c5
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Aug 30 22:07:48 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 31 19:57:30 2021 +0200

    flatten SfxAppData_Impl
    
    no need to allocate things separately that are always allocated
    with this object
    
    Change-Id: I6acc215fa1f86625f300cd7717ee5d40a6bc986b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121341
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index f4027064494d..83c59e708872 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -243,7 +243,7 @@ void SfxApplication::ResetLastDir()
 
 SfxDispatcher* SfxApplication::GetDispatcher_Impl()
 {
-    return pImpl->pViewFrame ? pImpl->pViewFrame->GetDispatcher() : pImpl->pAppDispat.get();
+    return pImpl->pViewFrame ? pImpl->pViewFrame->GetDispatcher() : &*pImpl->pAppDispat;
 }
 
 
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index e17d9eb88cf6..a20bec463334 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -186,14 +186,14 @@ void SfxApplication::Initialize_Impl()
     Help::EnableContextHelp();
     Help::EnableExtHelp();
 
-    pImpl->m_pToolsErrorHdl.reset(new SfxErrorHandler(
-        RID_ERRHDL, ErrCodeArea::Io, ErrCodeArea::Vcl));
+    pImpl->m_pToolsErrorHdl.emplace(
+        RID_ERRHDL, ErrCodeArea::Io, ErrCodeArea::Vcl);
 
-    pImpl->m_pSoErrorHdl.reset(new SfxErrorHandler(
-        RID_SO_ERROR_HANDLER, ErrCodeArea::So, ErrCodeArea::So, SvtResLocale()));
+    pImpl->m_pSoErrorHdl.emplace(
+        RID_SO_ERROR_HANDLER, ErrCodeArea::So, ErrCodeArea::So, SvtResLocale());
 #if HAVE_FEATURE_SCRIPTING
-    pImpl->m_pSbxErrorHdl.reset(new SfxErrorHandler(
-        RID_BASIC_START, ErrCodeArea::Sbx, ErrCodeArea::Sbx, BasResLocale()));
+    pImpl->m_pSbxErrorHdl.emplace(
+        RID_BASIC_START, ErrCodeArea::Sbx, ErrCodeArea::Sbx, BasResLocale());
 #endif
 
     if (!utl::ConfigManager::IsFuzzing())
@@ -205,8 +205,8 @@ void SfxApplication::Initialize_Impl()
     }
 
     DBG_ASSERT( !pImpl->pAppDispat, "AppDispatcher already exists" );
-    pImpl->pAppDispat.reset(new SfxDispatcher);
-    pImpl->pSlotPool.reset(new SfxSlotPool);
+    pImpl->pAppDispat.emplace();
+    pImpl->pSlotPool.emplace();
 
     Registrations_Impl();
 
diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx
index f7ddfb297d6a..eb5f0ce21062 100644
--- a/sfx2/source/appl/appmisc.cxx
+++ b/sfx2/source/appl/appmisc.cxx
@@ -98,7 +98,7 @@ SfxModule* SfxApplication::GetModule_Impl()
 }
 
 bool  SfxApplication::IsDowning() const { return pImpl->bDowning; }
-SfxDispatcher* SfxApplication::GetAppDispatcher_Impl() { return pImpl->pAppDispat.get(); }
+SfxDispatcher* SfxApplication::GetAppDispatcher_Impl() { return &*pImpl->pAppDispat; }
 SfxSlotPool& SfxApplication::GetAppSlotPool_Impl() const { return *pImpl->pSlotPool; }
 
 static bool FileExists( const INetURLObject& rURL )
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index 8b225d251372..121ba43f5581 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -26,8 +26,10 @@
 #include <svl/svdde.hxx>
 #include <svtools/ehdl.hxx>
 #include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
 #include <sfx2/doctempl.hxx>
 #include <sfx2/fcontnr.hxx>
+#include <sfx2/msgpool.hxx>
 #include <o3tl/enumarray.hxx>
 #include "sfxpicklist.hxx"
 
@@ -46,8 +48,6 @@ class SfxStatusDispatcher;
 class SfxDdeTriggerTopic_Impl;
 class SfxFrame;
 class SfxViewFrame;
-class SfxSlotPool;
-class SfxDispatcher;
 class SfxInterface;
 class BasicManager;
 class SfxBasicManagerHolder;
@@ -76,10 +76,10 @@ public:
 
     // application members
     std::optional<SfxFilterMatcher>     pMatcher;
-    std::unique_ptr<SfxErrorHandler>    m_pToolsErrorHdl;
-    std::unique_ptr<SfxErrorHandler>    m_pSoErrorHdl;
+    std::optional<SfxErrorHandler>    m_pToolsErrorHdl;
+    std::optional<SfxErrorHandler>    m_pSoErrorHdl;
 #if HAVE_FEATURE_SCRIPTING
-    std::unique_ptr<SfxErrorHandler>    m_pSbxErrorHdl;
+    std::optional<SfxErrorHandler>    m_pSbxErrorHdl;
 #endif
     rtl::Reference<SfxStatusDispatcher> mxAppDispatch;
     std::optional<SfxPickList>          mxAppPickList;
@@ -107,9 +107,8 @@ public:
     std::unique_ptr<SfxBasicManagerCreationListener>
                                 pBasMgrListener;
     SfxViewFrame*               pViewFrame;
-    std::unique_ptr<SfxSlotPool>
-                                pSlotPool;
-    std::unique_ptr<SfxDispatcher>
+    std::optional<SfxSlotPool>  pSlotPool;
+    std::optional<SfxDispatcher>
                                 pAppDispat;     // Dispatcher if no document
     ::rtl::Reference<sfx2::sidebar::Theme> m_pSidebarTheme;
 


More information about the Libreoffice-commits mailing list