[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat May 29 10:41:49 UTC 2021


 sw/inc/calbck.hxx                        |    4 ++--
 sw/source/core/attr/calbck.cxx           |    9 ++++-----
 sw/source/uibase/docvw/AnnotationWin.cxx |    3 ---
 3 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit e4b5aaade285ecad39332ad8b195738feb51151a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri May 28 12:19:09 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat May 29 12:41:23 2021 +0200

    no need to allocate this hint on the heap
    
    Change-Id: I6321d03cb5786aa0c17705cc8c8bcf1f85326f44
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116369
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 11a62033c5cc..0863b2da7f2f 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -30,6 +30,7 @@
 #include <type_traits>
 #include <vector>
 #include <memory>
+#include <optional>
 
 class SwModify;
 class SwFormat;
@@ -76,7 +77,6 @@ namespace sw
     struct ModifyChangedHint final: SfxHint
     {
         ModifyChangedHint(const SwModify* pNew) : m_pNew(pNew) {};
-        virtual ~ModifyChangedHint() override;
         const SwModify* m_pNew;
     };
     // Observer pattern using svl implementation
@@ -151,7 +151,7 @@ public:
 
     // in case an SwModify object is destroyed that itself is registered in another SwModify,
     // its SwClient objects can decide to get registered to the latter instead by calling this method
-    std::unique_ptr<sw::ModifyChangedHint> CheckRegistration( const SfxPoolItem* pOldValue );
+    std::optional<sw::ModifyChangedHint> CheckRegistration( const SfxPoolItem* pOldValue );
     // SwFormat wants to die different than the rest: It wants to reparent every client to its parent
     // and then send a SwFormatChg hint.
     void CheckRegistrationFormat(SwFormat& rOld);
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index a37ee5bef376..3f4253cd2566 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -54,7 +54,6 @@ namespace sw
 }
 
 sw::LegacyModifyHint::~LegacyModifyHint() {}
-sw::ModifyChangedHint::~ModifyChangedHint() {}
 
 SwClient::SwClient(SwClient&& o) noexcept
     : m_pRegisteredIn(nullptr)
@@ -75,19 +74,19 @@ SwClient::~SwClient()
         m_pRegisteredIn->Remove( this );
 }
 
-std::unique_ptr<sw::ModifyChangedHint> SwClient::CheckRegistration( const SfxPoolItem* pOld )
+std::optional<sw::ModifyChangedHint> SwClient::CheckRegistration( const SfxPoolItem* pOld )
 {
     DBG_TESTSOLARMUTEX();
     // this method only handles notification about dying SwModify objects
     if( !pOld || pOld->Which() != RES_OBJECTDYING )
-        return nullptr;
+        return {};
 
     assert(dynamic_cast<const SwPtrMsgPoolItem*>(pOld));
     const SwPtrMsgPoolItem* pDead = static_cast<const SwPtrMsgPoolItem*>(pOld);
     if(pDead->pObject != m_pRegisteredIn)
     {
         // we should only care received death notes from objects we are following
-        return nullptr;
+        return {};
     }
     // I've got a notification from the object I know
     SwModify* pAbove = m_pRegisteredIn->GetRegisteredIn();
@@ -102,7 +101,7 @@ std::unique_ptr<sw::ModifyChangedHint> SwClient::CheckRegistration( const SfxPoo
         // destroy connection
         EndListeningAll();
     }
-    return std::unique_ptr<sw::ModifyChangedHint>(new sw::ModifyChangedHint(pAbove));
+    return sw::ModifyChangedHint(pAbove);
 }
 
 void SwClient::CheckRegistrationFormat(SwFormat& rOld)
commit 1df758fce8ac23b54f96f2c0f3dd608bb1da024a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri May 28 15:59:43 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat May 29 12:41:05 2021 +0200

    remove IsDisposed check in sw
    
    already checked by call sites
    
    Change-Id: Id03d07b7aebd36e891f831ff4bdab7e63a7c4ff7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116345
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index e354a62204a8..01d12affedad 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -138,9 +138,6 @@ SwAnnotationWin::~SwAnnotationWin()
 
 void SwAnnotationWin::dispose()
 {
-    if (IsDisposed())
-        return;
-
     mrMgr.DisconnectSidebarWinFromFrame( *(mrSidebarItem.maLayoutInfo.mpAnchorFrame),
                                        *this );
 


More information about the Libreoffice-commits mailing list