sw/inc/docary.hxx                   |   27 +++++++++++++++------------
 sw/source/core/doc/docbasic.cxx     |    8 ++++++--
 sw/source/core/doc/docfmt.cxx       |   11 ++++++++---
 sw/source/core/doc/number.cxx       |    4 +++-
 sw/source/core/frmedt/fefly1.cxx    |    6 +++---
 sw/source/core/undo/rolbck.cxx      |   18 +++++++++---------
 sw/source/core/undo/unattr.cxx      |   33 +++++++++++++++++++--------------
 sw/source/core/undo/undobj1.cxx     |    4 ++--
 sw/source/core/undo/unfmco.cxx      |    2 +-
 sw/source/core/undo/untblk.cxx      |    8 ++++----
 sw/source/filter/basflt/shellio.cxx |    3 ++-
 11 files changed, 72 insertions(+), 52 deletions(-)

New commits:
commit 91646b10315e2ee64b25fb8a604012c729343c07
Author: Michael Stahl <mst...@redhat.com>
Date:   Wed May 3 13:40:15 2017 +0200

    tdf#88555 sw: use safe IsAlive function in Undo code
    
    Now that we have some safe way to check if the formats are still alive,
    replace 1df637bde32c484b681ecdfebf56fdca03db7fc1 with this.
    
    Change-Id: I3d5bd9c16f5cadd90281eff7a8b42d03ccd4c672

diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 058edab78750..8a0d68d15fc9 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -201,21 +201,23 @@ bool SwUndoFormatAttr::IsFormatInDoc( SwDoc* pDoc )
 {
     // search for the Format in the Document; if it does not exist any more,
     // the attribute is not restored!
-    size_t nPos = SIZE_MAX;
+    bool isAlive(false);
     switch ( m_nFormatWhich )
     {
         case RES_TXTFMTCOLL:
         case RES_CONDTXTFMTCOLL:
-            nPos = pDoc->GetTextFormatColls()->GetPos( m_pFormat );
+            isAlive = pDoc->GetTextFormatColls()->IsAlive(
+                    static_cast<const SwTextFormatColl *>(m_pFormat));
             break;
 
         case RES_GRFFMTCOLL:
-            nPos = pDoc->GetGrfFormatColls()->GetPos(
-                    static_cast<const SwGrfFormatColl*>(m_pFormat) );
+            isAlive = pDoc->GetGrfFormatColls()->IsAlive(
+                    static_cast<const SwGrfFormatColl*>(m_pFormat));
             break;
 
         case RES_CHRFMT:
-            nPos = pDoc->GetCharFormats()->GetPos( m_pFormat );
+            isAlive = pDoc->GetCharFormats()->IsAlive(
+                    static_cast<const SwCharFormat *>(m_pFormat));
             break;
 
         case RES_FRMFMT:
@@ -226,14 +228,14 @@ bool SwUndoFormatAttr::IsFormatInDoc( SwDoc* pDoc )
                 {
                     m_pFormat =
                         
static_cast<SwTableNode*>(pNd)->GetTable().GetFrameFormat();
-                    nPos = 0;
+                    isAlive = true;
                     break;
                 }
                 else if ( pNd->IsSectionNode() )
                 {
                     m_pFormat =
                         
static_cast<SwSectionNode*>(pNd)->GetSection().GetFormat();
-                    nPos = 0;
+                    isAlive = true;
                     break;
                 }
                 else if ( pNd->IsStartNode() && (SwTableBoxStartNode ==
@@ -247,7 +249,7 @@ bool SwUndoFormatAttr::IsFormatInDoc( SwDoc* pDoc )
                         if ( pBox )
                         {
                             m_pFormat = pBox->GetFrameFormat();
-                            nPos = 0;
+                            isAlive = true;
                             break;
                         }
                     }
@@ -256,13 +258,15 @@ bool SwUndoFormatAttr::IsFormatInDoc( SwDoc* pDoc )
             SAL_FALLTHROUGH;
         case RES_DRAWFRMFMT:
         case RES_FLYFRMFMT:
-            if ( ( pDoc->GetSpzFrameFormats()->find( 
static_cast<SwFrameFormat*>(m_pFormat) ) != pDoc->GetSpzFrameFormats()->end() )
-                || ( pDoc->GetFrameFormats()->find( 
static_cast<SwFrameFormat*>( m_pFormat ) ) != pDoc->GetFrameFormats()->end() ) )
-                nPos = 0;
+            if (pDoc->GetSpzFrameFormats()->IsAlive(static_cast<const 
SwFrameFormat *>(m_pFormat))
+                || pDoc->GetFrameFormats()->IsAlive(static_cast<const 
SwFrameFormat *>(m_pFormat)))
+            {
+                isAlive = true;
+            }
             break;
     }
 
-    if ( nPos == SIZE_MAX )
+    if (!isAlive)
     {
         // Format does not exist; reset
         m_pFormat = nullptr;
diff --git a/sw/source/core/undo/unfmco.cxx b/sw/source/core/undo/unfmco.cxx
index aa55ba045ca0..056ab4080c72 100644
--- a/sw/source/core/undo/unfmco.cxx
+++ b/sw/source/core/undo/unfmco.cxx
@@ -73,7 +73,7 @@ void SwUndoFormatColl::DoSetFormatColl(SwDoc & rDoc, SwPaM & 
rPaM)
     // this array.
 
     // does the format still exist?
-    if( SIZE_MAX != 
rDoc.GetTextFormatColls()->GetPos(static_cast<SwTextFormatColl*>(pFormatColl)) )
+    if 
(rDoc.GetTextFormatColls()->IsAlive(static_cast<SwTextFormatColl*>(pFormatColl)))
     {
         rDoc.SetTextFormatColl(rPaM, 
static_cast<SwTextFormatColl*>(pFormatColl), mbReset,
                            mbResetListAttrs);
commit 8d31f114327e77c48c8cdc804e1e399ebeadd27c
Author: Michael Stahl <mst...@redhat.com>
Date:   Wed May 3 13:04:08 2017 +0200

    tdf#88555 sw: reduce usage of dynamic_cast in SwFormatsModifyBase::Contains
    
    This is a bad idea as the function is sometimes used to check if a
    SwFormat has been deleted, which can happen in Undo.
    
    Replace with ContainsFormat() and IsAlive(), and don't require a
    non-const SwFormat parameter so that the dynamic_cast using one
    isn't called all the time but only called once where it's safe.
    
    Change-Id: Ib74b79629f5c8ed432a912ada5974a6d816e7d31

diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 10e41d68f901..a63bb34cc307 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -23,6 +23,7 @@
 #include <vector>
 #include <set>
 #include <algorithm>
+#include <type_traits>
 #include <o3tl/sorted_vector.hxx>
 
 #include <boost/multi_index_container.hpp>
@@ -135,7 +136,8 @@ public:
         return it == end() ? SIZE_MAX : it - begin();
     }
 
-    bool Contains(Value const& p) const
+    /// check that given format is still alive (i.e. contained here)
+    bool IsAlive(typename std::remove_pointer<Value>::type const*const p) const
         { return std::find(begin(), end(), p) != end(); }
 
     static void dumpAsXml(struct _xmlTextWriter* /*pWriter*/) {};
@@ -158,9 +160,12 @@ public:
 
     size_t GetPos(const SwFormat *p) const
         { return SwVectorModifyBase<Value>::GetPos( static_cast<Value>( 
const_cast<SwFormat*>( p ) ) ); }
-    bool Contains(const SwFormat *p) const {
-        Value p2 = dynamic_cast<Value>(const_cast<SwFormat*>(p));
-        return p2 != nullptr && SwVectorModifyBase<Value>::Contains(p2);
+
+    /// check if given format is contained here
+    /// @precond pFormat must not have been deleted
+    bool ContainsFormat(SwFormat const*const pFormat) const {
+        Value p = dynamic_cast<Value>(const_cast<SwFormat*>(pFormat));
+        return p != nullptr && SwVectorModifyBase<Value>::IsAlive(p);
     }
 };
 
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 286d2269b0b2..f414b3a6a226 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -800,11 +800,13 @@ SwNumRule& SwNumRule::CopyNumRule( SwDoc* pDoc, const 
SwNumRule& rNumRule )
     {
         Set( n, rNumRule.maFormats[ n ] );
         if( maFormats[ n ] && maFormats[ n ]->GetCharFormat() &&
-            !pDoc->GetCharFormats()->Contains( maFormats[n]->GetCharFormat() ))
+            !pDoc->GetCharFormats()->IsAlive(maFormats[n]->GetCharFormat()))
+        {
             // If we copy across different Documents, then copy the
             // corresponding CharFormat into the new Document.
             maFormats[n]->SetCharFormat( pDoc->CopyCharFormat( *maFormats[n]->
                                         GetCharFormat() ) );
+        }
     }
     meRuleType = rNumRule.meRuleType;
     msName = rNumRule.msName;
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 4b3ce11653f4..93c25f85bc5c 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -228,7 +228,7 @@ void SwHistorySetText::SetInDoc( SwDoc* pDoc, bool )
     if ( RES_TXTATR_CHARFMT == m_pAttr->Which() )
     {
         // ask the Doc if the CharFormat still exists
-        if ( !pDoc->GetCharFormats()->Contains( 
(static_cast<SwFormatCharFormat&>(*m_pAttr)).GetCharFormat() ) )
+        if 
(!pDoc->GetCharFormats()->IsAlive((static_cast<SwFormatCharFormat&>(*m_pAttr)).GetCharFormat()))
             return; // do not set, format does not exist
     }
 
@@ -522,12 +522,12 @@ void SwHistoryChangeFormatColl::SetInDoc( SwDoc* pDoc, 
bool )
     {
         if ( SwNodeType::Text == m_nNodeType )
         {
-            if (pDoc->GetTextFormatColls()->Contains( 
static_cast<SwTextFormatColl * const>(m_pColl) ))
+            if 
(pDoc->GetTextFormatColls()->IsAlive(static_cast<SwTextFormatColl * 
const>(m_pColl)))
             {
                 pContentNd->ChgFormatColl( m_pColl );
             }
         }
-        else if (pDoc->GetGrfFormatColls()->Contains( 
static_cast<SwGrfFormatColl * const>(m_pColl) ))
+        else if 
(pDoc->GetGrfFormatColls()->IsAlive(static_cast<SwGrfFormatColl * 
const>(m_pColl)))
         {
             pContentNd->ChgFormatColl( m_pColl );
         }
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index f631dc00706b..058edab78750 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -141,7 +141,7 @@ void SwUndoFormatAttr::Init()
                 m_nNodeIndex = pTable->GetTabSortBoxes()[ 0 ]->GetSttNd()
                                ->FindTableNode()->GetIndex();
             }
-        } else if ( pDoc->GetSections().Contains( m_pFormat )) {
+        } else if (pDoc->GetSections().ContainsFormat(m_pFormat)) {
             m_nNodeIndex = m_pFormat->GetContent().GetContentIdx()->GetIndex();
         } else if ( dynamic_cast< SwTableBoxFormat* >( m_pFormat ) !=  nullptr 
) {
             SwTableBox * pTableBox = SwIterator<SwTableBox,SwFormat>( 
*m_pFormat ).First();
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 3ce8864999e8..9c5ac1eb8ec0 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -230,7 +230,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & 
rContext)
 
             pTextNode->ResetAllAttr();
 
-            if (rDoc.GetTextFormatColls()->Contains(pTextFormatColl))
+            if (rDoc.GetTextFormatColls()->IsAlive(pTextFormatColl))
                 pTextFormatColl = 
static_cast<SwTextFormatColl*>(pTextNode->ChgFormatColl( pTextFormatColl )) ;
 
             pHistory->SetTmpEnd( nSetPos );
@@ -269,7 +269,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & 
rContext)
         rPam.Exchange();
     }
 
-    if( pDoc->GetTextFormatColls()->Contains( pTextFormatColl ))
+    if (pDoc->GetTextFormatColls()->IsAlive(pTextFormatColl))
     {
         SwTextNode* pTextNd = rPam.GetMark()->nNode.GetNode().GetTextNode();
         if( pTextNd )
@@ -277,8 +277,8 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & 
rContext)
     }
     pTextFormatColl = pSavTextFormatColl;
 
-    if( pLastNdColl && pDoc->GetTextFormatColls()->Contains( pLastNdColl ) &&
-        rPam.GetPoint()->nNode != rPam.GetMark()->nNode )
+    if (pLastNdColl && pDoc->GetTextFormatColls()->IsAlive(pLastNdColl)
+        && rPam.GetPoint()->nNode != rPam.GetMark()->nNode)
     {
         SwTextNode* pTextNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
         if( pTextNd )
diff --git a/sw/source/filter/basflt/shellio.cxx 
b/sw/source/filter/basflt/shellio.cxx
index a487e0b05b2b..d2fa62bf0672 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -226,7 +226,8 @@ sal_uLong SwReader::Read( const Reader& rOptions )
             {
                 SwFrameFormat* pFrameFormat = (*mxDoc->GetSpzFrameFormats())[ 
n ];
                 const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor();
-                if( !aFlyFrameArr.Contains( pFrameFormat) )
+                // ok, here IsAlive is a misnomer...
+                if (!aFlyFrameArr.IsAlive(pFrameFormat))
                 {
                     SwPosition const*const pFrameAnchor(
                             rAnchor.GetContentAnchor());
commit 01575a06725648188d51de90323a6f1da97ef7a9
Author: Michael Stahl <mst...@redhat.com>
Date:   Tue May 2 22:45:48 2017 +0200

    tdf#88555 sw: remove dynamic_cast from SwFrameFormats::Contains
    
    This is a bad idea as the function is sometimes used to check if a
    SwFrameFormat has been deleted, which can happen in Undo, and for
    SwCallMouseEvent before commit 32403675bf9d2d0380956f9a82da71593edbb53c
    
    Replace with ContainsFormat() and IsAlive(), and don't require a
    non-const SwFrameFormat parameter.
    
    Change-Id: I87ede94dfbfe7f6985f13faab4c156015c3a5fc0

diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 6d25e85dcc74..10e41d68f901 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -225,7 +225,7 @@ public:
 
     // Get the iterator of the exact object (includes pointer!),
     // e.g for position with std::distance.
-    // There is also Contains, if you don't need the position.
+    // There is also ContainsFormat, if you don't need the position.
     const_iterator find( const value_type& x ) const;
 
     // As this array is non-unique related to type and name,
@@ -253,8 +253,11 @@ public:
     virtual size_t GetFormatCount() const override { return m_Array.size(); }
     virtual SwFormat* GetFormat(size_t idx) const override { return 
operator[]( idx ); }
 
-    bool Contains( const value_type& x ) const;
-    inline bool Contains( const SwFormat* p ) const;
+    /// fast check if given format is contained here
+    /// @precond pFormat must not have been deleted
+    bool ContainsFormat(SwFrameFormat const* pFormat) const;
+    /// not so fast check that given format is still alive (i.e. contained 
here)
+    bool IsAlive(SwFrameFormat const*) const;
 
     void DeleteAndDestroyAll( bool keepDefault = false );
 
@@ -262,11 +265,6 @@ public:
     void newDefault( const_iterator const& position );
 };
 
-inline bool SwFrameFormats::Contains( const SwFormat* p ) const
-{
-    value_type p2 = dynamic_cast<value_type>(const_cast<SwFormat*>( p ));
-    return p2 != nullptr && this->Contains( p2 );
-}
 
 /// Unsorted, undeleting SwFrameFormat vector
 class SwFrameFormatsV : public SwFormatsModifyBase<SwFrameFormat*>
diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx
index dd27799b79f2..8b4ee3a007fd 100644
--- a/sw/source/core/doc/docbasic.cxx
+++ b/sw/source/core/doc/docbasic.cxx
@@ -164,8 +164,12 @@ sal_uInt16 SwDoc::CallEvent( sal_uInt16 nEvent, const 
SwCallMouseEvent& rCallEve
             const SwFrameFormat* pFormat = rCallEvent.PTR.pFormat;
             if( bCheckPtr )
             {
-                if ( GetSpzFrameFormats()->Contains( pFormat ) )
+                if (GetSpzFrameFormats()->IsAlive(pFormat))
                     bCheckPtr = false;      // misuse as a flag
+                else
+                    // this shouldn't be possible now that SwCallMouseEvent
+                    // listens for dying format?
+                    assert(false);
             }
             if( !bCheckPtr )
                 pTable = &pFormat->GetMacro().GetMacroTable();
@@ -179,7 +183,7 @@ sal_uInt16 SwDoc::CallEvent( sal_uInt16 nEvent, const 
SwCallMouseEvent& rCallEve
             {
                 const SwFrameFormat* pFormat = rCallEvent.PTR.IMAP.pFormat;
                 const ImageMap* pIMap;
-                if( GetSpzFrameFormats()->Contains( pFormat ) &&
+                if (GetSpzFrameFormats()->IsAlive(pFormat) &&
                     nullptr != (pIMap = pFormat->GetURL().GetMap()) )
                 {
                     for( size_t nPos = pIMap->GetIMapObjectCount(); nPos; )
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 5dff133d929f..544c30eaad55 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -711,7 +711,7 @@ void SwDoc::DelFrameFormat( SwFrameFormat *pFormat, bool 
bBroadcast )
     else
     {
         // The format has to be in the one or the other, we'll see in which 
one.
-        if ( mpFrameFormatTable->Contains( pFormat ) )
+        if (mpFrameFormatTable->ContainsFormat(pFormat))
         {
             if (bBroadcast)
                 BroadcastStyleOperation(pFormat->GetName(),
@@ -730,7 +730,7 @@ void SwDoc::DelFrameFormat( SwFrameFormat *pFormat, bool 
bBroadcast )
         }
         else
         {
-            bool contains = GetSpzFrameFormats()->Contains( pFormat );
+            bool contains = GetSpzFrameFormats()->ContainsFormat(pFormat);
             OSL_ENSURE( contains, "FrameFormat not found." );
             if( contains )
             {
@@ -2116,11 +2116,16 @@ void SwFrameFormats::erase( const_iterator const& 
position )
     m_PosIndex.erase( begin() + (position - begin()) );
 }
 
-bool SwFrameFormats::Contains( const SwFrameFormats::value_type& x ) const
+bool SwFrameFormats::ContainsFormat(const SwFrameFormat *const x) const
 {
     return (x->m_ffList == this);
 }
 
+bool SwFrameFormats::IsAlive(SwFrameFormat const*const p) const
+{
+    return find(const_cast<SwFrameFormat*>(p)) != end();
+}
+
 bool SwFrameFormats::newDefault( const value_type& x )
 {
     std::pair<iterator,bool> res = m_PosIndex.push_front( x );
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 4a103aef478f..66fbcfcee252 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -947,7 +947,7 @@ void SwFEShell::SetPageObjsNewPage( 
std::vector<SwFrameFormat*>& rFillArr )
     bool bTmpAssert = false;
     for( auto pFormat : rFillArr )
     {
-        if( mpDoc->GetSpzFrameFormats()->Contains( pFormat ))
+        if (mpDoc->GetSpzFrameFormats()->IsAlive(pFormat))
         {
             // FlyFormat is still valid, therefore process
 
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 9c6116a5e568..4b3ce11653f4 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -786,7 +786,7 @@ void SwHistoryChangeFlyAnchor::SetInDoc( SwDoc* pDoc, bool )
 {
     ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
 
-    if ( pDoc->GetSpzFrameFormats()->Contains( &m_rFormat ) )    // Format 
does still exist
+    if (pDoc->GetSpzFrameFormats()->IsAlive(&m_rFormat)) // Format does still 
exist
     {
         SwFormatAnchor aTmp( m_rFormat.GetAnchor() );
 
@@ -824,12 +824,12 @@ SwHistoryChangeFlyChain::SwHistoryChangeFlyChain( 
SwFlyFrameFormat& rFormat,
 
 void SwHistoryChangeFlyChain::SetInDoc( SwDoc* pDoc, bool )
 {
-    if (pDoc->GetSpzFrameFormats()->Contains( m_pFlyFormat ) )
+    if (pDoc->GetSpzFrameFormats()->IsAlive(m_pFlyFormat))
     {
         SwFormatChain aChain;
 
-        if ( m_pPrevFormat &&
-             pDoc->GetSpzFrameFormats()->Contains( m_pPrevFormat ) )
+        if (m_pPrevFormat &&
+            pDoc->GetSpzFrameFormats()->IsAlive(m_pPrevFormat))
         {
             aChain.SetPrev( m_pPrevFormat );
             SwFormatChain aTmp( m_pPrevFormat->GetChain() );
@@ -837,8 +837,8 @@ void SwHistoryChangeFlyChain::SetInDoc( SwDoc* pDoc, bool )
             m_pPrevFormat->SetFormatAttr( aTmp );
         }
 
-        if ( m_pNextFormat &&
-             pDoc->GetSpzFrameFormats()->Contains( m_pNextFormat ) )
+        if (m_pNextFormat &&
+            pDoc->GetSpzFrameFormats()->IsAlive(m_pNextFormat))
         {
             aChain.SetNext( m_pNextFormat );
             SwFormatChain aTmp( m_pNextFormat->GetChain() );
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 9805ed309dd9..f631dc00706b 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -133,7 +133,8 @@ void SwUndoFormatAttr::Init()
         SaveFlyAnchor( m_bSaveDrawPt );
     } else if ( RES_FRMFMT == m_nFormatWhich ) {
         SwDoc* pDoc = m_pFormat->GetDoc();
-        if ( pDoc->GetTableFrameFormats()->Contains( m_pFormat )) {
+        if 
(pDoc->GetTableFrameFormats()->ContainsFormat(dynamic_cast<SwFrameFormat*>(m_pFormat)))
+        {
             // Table Format: save table position, table formats are volatile!
             SwTable * pTable = SwIterator<SwTable,SwFormat>( *m_pFormat 
).First();
             if ( pTable ) {
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index 94d05c0386a0..b5f27ce5b33f 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -519,7 +519,7 @@ void SwUndoSetFlyFormat::UndoImpl(::sw::UndoRedoContext & 
rContext)
     SwDoc & rDoc = rContext.GetDoc();
 
     // Is the new Format still existent?
-    if( rDoc.GetFrameFormats()->Contains( pOldFormat ) )
+    if (rDoc.GetFrameFormats()->IsAlive(pOldFormat))
     {
         if( bAnchorChgd )
             pFrameFormat->DelFrames();
@@ -592,7 +592,7 @@ void SwUndoSetFlyFormat::RedoImpl(::sw::UndoRedoContext & 
rContext)
     SwDoc & rDoc = rContext.GetDoc();
 
     // Is the new Format still existent?
-    if( rDoc.GetFrameFormats()->Contains( pNewFormat ) )
+    if (rDoc.GetFrameFormats()->IsAlive(pNewFormat))
     {
 
         if( bAnchorChgd )
commit 389203a02b36734b6c1b3a73991c43aa43708ac8
Author: Michael Stahl <mst...@redhat.com>
Date:   Tue May 2 22:30:01 2017 +0200

    sw: remove nonsense from comments
    
    Change-Id: I6269db723507769ff2713710d55f98f9acd2dbf0

diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 0ae32beb8608..4a103aef478f 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -703,7 +703,7 @@ const SwFrameFormat *SwFEShell::NewFlyFrame( const 
SfxItemSet& rSet, bool bAnchV
             {
                 // calculate new position
                 // JP 24.03.97: also go via page links
-                //              chaos::anchor should not lie in the shifted 
area
+                //              anchor should not lie in the shifted area
                 pRet->DelFrames();
 
                 const SwFrame* pAnch = ::FindAnchor( GetLayout(), aPt );
@@ -954,7 +954,7 @@ void SwFEShell::SetPageObjsNewPage( 
std::vector<SwFrameFormat*>& rFillArr )
             SwFormatAnchor aNewAnchor( pFormat->GetAnchor() );
             if ((RndStdIds::FLY_AT_PAGE != aNewAnchor.GetAnchorId()) ||
                 0 >= ( nNewPage = aNewAnchor.GetPageNum() + 1 ) )
-                // chaos::Anchor has been changed or invalid page number,
+                // Anchor has been changed or invalid page number,
                 // therefore: do not change!
                 continue;
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to