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

Stephan Bergmann sbergman at redhat.com
Tue Aug 5 09:34:37 PDT 2014


 sw/source/core/layout/ssfrm.cxx |   24 ------------------------
 sw/source/core/text/txtfrm.cxx  |   28 ++++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 24 deletions(-)

New commits:
commit 32de046e05a5907a85d85cee0b293cab858a0400
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Aug 5 18:33:56 2014 +0200

    Move SwTxtFrm specific code from ~SwCntntFrm down to ~SwTxtFrm
    
    ...to be executed while this is still a SwTxtFrm, not merely a SwCntntFrm.
    
    Change-Id: Ia2ce9fff7d7e2562deb4bd099975976312cad6c4

diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index 23dcc2b..e1cb418 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -432,30 +432,6 @@ SwCntntFrm::~SwCntntFrm()
             pRoot->DisallowTurbo();
             pRoot->ResetTurbo();
         }
-        if( IsTxtFrm() && ((SwTxtFrm*)this)->HasFtn() )
-        {
-            SwTxtNode *pTxtNd = ((SwTxtFrm*)this)->GetTxtNode();
-            const SwFtnIdxs &rFtnIdxs = pCNd->GetDoc()->GetFtnIdxs();
-            sal_uInt16 nPos;
-            sal_uLong nIndex = pCNd->GetIndex();
-            rFtnIdxs.SeekEntry( *pTxtNd, &nPos );
-            SwTxtFtn* pTxtFtn;
-            if( nPos < rFtnIdxs.size() )
-            {
-                while( nPos && pTxtNd == &(rFtnIdxs[ nPos ]->GetTxtNode()) )
-                    --nPos;
-                if( nPos || pTxtNd != &(rFtnIdxs[ nPos ]->GetTxtNode()) )
-                    ++nPos;
-            }
-            while( nPos < rFtnIdxs.size() )
-            {
-                pTxtFtn = rFtnIdxs[ nPos ];
-                if( pTxtFtn->GetTxtNode().GetIndex() > nIndex )
-                    break;
-                pTxtFtn->DelFrms( this );
-                ++nPos;
-            }
-        }
     }
 }
 
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 42c27be..9da1256 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -74,6 +74,7 @@
 #include <fldupde.hxx>
 #include <IGrammarContact.hxx>
 #include <switerator.hxx>
+#include <ftnidx.hxx>
 
 TYPEINIT1( SwTxtFrm, SwCntntFrm );
 
@@ -368,6 +369,33 @@ SwTxtFrm::~SwTxtFrm()
 {
     // Remove associated SwParaPortion from pTxtCache
     ClearPara();
+
+    SwCntntNode* pCNd;
+    if( 0 != ( pCNd = PTR_CAST( SwCntntNode, GetRegisteredIn() )) &&
+        !pCNd->GetDoc()->IsInDtor() && HasFtn() )
+    {
+        SwTxtNode *pTxtNd = ((SwTxtFrm*)this)->GetTxtNode();
+        const SwFtnIdxs &rFtnIdxs = pCNd->GetDoc()->GetFtnIdxs();
+        sal_uInt16 nPos;
+        sal_uLong nIndex = pCNd->GetIndex();
+        rFtnIdxs.SeekEntry( *pTxtNd, &nPos );
+        SwTxtFtn* pTxtFtn;
+        if( nPos < rFtnIdxs.size() )
+        {
+            while( nPos && pTxtNd == &(rFtnIdxs[ nPos ]->GetTxtNode()) )
+                --nPos;
+            if( nPos || pTxtNd != &(rFtnIdxs[ nPos ]->GetTxtNode()) )
+                ++nPos;
+        }
+        while( nPos < rFtnIdxs.size() )
+        {
+            pTxtFtn = rFtnIdxs[ nPos ];
+            if( pTxtFtn->GetTxtNode().GetIndex() > nIndex )
+                break;
+            pTxtFtn->DelFrms( this );
+            ++nPos;
+        }
+    }
 }
 
 const OUString& SwTxtFrm::GetTxt() const


More information about the Libreoffice-commits mailing list