sw/source/core/doc/lineinfo.cxx             |    4 ++--
 sw/source/core/doc/number.cxx               |   12 ++++++------
 sw/source/core/docnode/node.cxx             |    2 +-
 sw/source/core/layout/atrfrm.cxx            |    8 ++++----
 sw/source/core/para/paratr.cxx              |    3 +--
 sw/source/core/txtnode/SwGrammarContact.cxx |    4 ++--
 sw/source/core/txtnode/txtatr2.cxx          |    8 ++++----
 7 files changed, 20 insertions(+), 21 deletions(-)

New commits:
commit 93cabd565d412ea65ffd0c3fc01025a52d47ca4e
Author: Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
Date:   Thu Jan 25 02:21:24 2018 +0100

    more GetRegisteredIn obsoleted by StopListeningAll()
    
    Change-Id: I7d69a5112e03cec1b8ebdc389940557b4dbd1117
    Reviewed-on: https://gerrit.libreoffice.org/48550
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Björn Michaelsen <bjoern.michael...@libreoffice.org>

diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx
index d8cf7439a38e..f8599bd94f1d 100644
--- a/sw/source/core/doc/lineinfo.cxx
+++ b/sw/source/core/doc/lineinfo.cxx
@@ -84,8 +84,8 @@ SwLineNumberInfo& SwLineNumberInfo::operator=(const 
SwLineNumberInfo &rCpy)
 {
     if ( rCpy.GetRegisteredIn() )
         const_cast<SwModify*>(rCpy.GetRegisteredIn())->Add( this );
-    else if ( GetRegisteredIn() )
-        GetRegisteredInNonConst()->Remove( this );
+    else
+        EndListeningAll();
 
     aType = rCpy.GetNumType();
     aDivider = rCpy.GetDivider();
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index b60a20168802..8912e30363b7 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -217,8 +217,8 @@ SwNumFormat::SwNumFormat(const SvxNumberFormat& rNumFormat, 
SwDoc* pDoc)
         }
         pCFormat->Add( this );
     }
-    else if( GetRegisteredIn() )
-        GetRegisteredInNonConst()->Remove( this );
+    else
+        EndListeningAll();
 }
 
 SwNumFormat::~SwNumFormat()
@@ -259,8 +259,8 @@ SwNumFormat& SwNumFormat::operator=( const SwNumFormat& 
rNumFormat)
     SvxNumberFormat::operator=(rNumFormat);
     if( rNumFormat.GetRegisteredIn() )
         rNumFormat.GetRegisteredInNonConst()->Add( this );
-    else if( GetRegisteredIn() )
-        GetRegisteredInNonConst()->Remove( this );
+    else
+        EndListeningAll();
     //For i120928,record the cp info of graphic within bullet
     m_cGrfBulletCP = rNumFormat.m_cGrfBulletCP;
     return *this;
@@ -277,8 +277,8 @@ void SwNumFormat::SetCharFormat( SwCharFormat* pChFormat)
 {
     if( pChFormat )
         pChFormat->Add( this );
-    else if( GetRegisteredIn() )
-        GetRegisteredInNonConst()->Remove( this );
+    else
+        EndListeningAll();
 }
 
 void SwNumFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 03e262ee2eb7..8e0636759083 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1042,7 +1042,7 @@ void SwContentNode::Modify( const SfxPoolItem* pOldValue, 
const SfxPoolItem* pNe
                 else
                 {
                     // Else register anyways when dying
-                    GetRegisteredIn()->Remove( this );
+                    EndListeningAll();
                     if ( GetpSwAttrSet() )
                         AttrSetHandleHelper::SetParent( mpAttrSet, *this, 
nullptr, nullptr );
                 }
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index e8b8c79091cc..7ca5544be310 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2055,16 +2055,16 @@ void SwFormatChain::SetPrev( SwFlyFrameFormat *pFormat )
 {
     if ( pFormat )
         pFormat->Add( &aPrev );
-    else if ( aPrev.GetRegisteredIn() )
-        aPrev.GetRegisteredIn()->Remove( &aPrev );
+    else
+        aPrev.EndListeningAll();
 }
 
 void SwFormatChain::SetNext( SwFlyFrameFormat *pFormat )
 {
     if ( pFormat )
         pFormat->Add( &aNext );
-    else if ( aNext.GetRegisteredIn() )
-        aNext.GetRegisteredIn()->Remove( &aNext );
+    else
+        aNext.EndListeningAll();
 }
 
 bool SwFormatChain::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
diff --git a/sw/source/core/para/paratr.cxx b/sw/source/core/para/paratr.cxx
index 68dc9bd1c5df..f66b388ffabe 100644
--- a/sw/source/core/para/paratr.cxx
+++ b/sw/source/core/para/paratr.cxx
@@ -66,8 +66,7 @@ void SwFormatDrop::SetCharFormat( SwCharFormat *pNew )
 {
     assert(!pNew || !pNew->IsDefault()); // expose cases that lead to 
use-after-free
     // Rewire
-    if ( GetRegisteredIn() )
-        GetRegisteredInNonConst()->Remove( this );
+    EndListeningAll();
     if(pNew)
         pNew->Add( this );
 }
diff --git a/sw/source/core/txtnode/SwGrammarContact.cxx 
b/sw/source/core/txtnode/SwGrammarContact.cxx
index 78ea24427659..d1ae37a7571d 100644
--- a/sw/source/core/txtnode/SwGrammarContact.cxx
+++ b/sw/source/core/txtnode/SwGrammarContact.cxx
@@ -94,7 +94,7 @@ void SwGrammarContact::updateCursorPosition( const 
SwPosition& rNewPos )
                 getMyTextNode()->SetGrammarCheck( mpProxyList );
                 SwTextFrame::repaintTextFrames( *getMyTextNode() );
             }
-            GetRegisteredInNonConst()->Remove( this ); // good bye old 
paragraph
+            EndListeningAll();
             mpProxyList = nullptr;
         }
         if( pTextNode )
@@ -152,7 +152,7 @@ void SwGrammarContact::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem * )
     if( pDead->pObject == GetRegisteredIn() )
     {    // if my current paragraph dies, I throw the proxy list away
         aTimer.Stop();
-        GetRegisteredInNonConst()->Remove( this );
+        EndListeningAll();
         delete mpProxyList;
         mpProxyList = nullptr;
     }
diff --git a/sw/source/core/txtnode/txtatr2.cxx 
b/sw/source/core/txtnode/txtatr2.cxx
index 7879abfd302c..a833dbe064f3 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -158,8 +158,8 @@ SwCharFormat* SwTextINetFormat::GetCharFormat()
 
     if ( pRet )
         pRet->Add( this );
-    else if ( GetRegisteredIn() )
-        GetRegisteredInNonConst()->Remove( this );
+    else
+        EndListeningAll();
 
     return pRet;
 }
@@ -277,8 +277,8 @@ SwCharFormat* SwTextRuby::GetCharFormat()
 
     if( pRet )
         pRet->Add( this );
-    else if( GetRegisteredIn() )
-        GetRegisteredInNonConst()->Remove( this );
+    else
+        EndListeningAll();
 
     return pRet;
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to