[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

Michael Stahl mstahl at redhat.com
Wed Dec 13 08:27:21 UTC 2017


 sw/source/core/layout/atrfrm.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 0c8a30ba47c6ed64c45063a060356e61e82a789f
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Dec 12 22:47:15 2017 +0100

    tdf#114396 sw: overly strict assertions in SwFrameFormat::Modify()
    
    It's only a problem if the style contains an anchor position;
    the anchor type by itself is fine, and the wrong assertion is
    particularly stupid considering that
    DocumentStylePoolManager::GetFormatFromPool() inits various
    built-in styles with anchor types.
    
    (regression from eed046433a847d3005e52c38963fb883322a39e6)
    
    Change-Id: If8ac000b7f888686725d6bf0ef8e5fb38198c889
    (cherry picked from commit 1e70464c380ecc0756ea29098632c503a60aec71)
    Reviewed-on: https://gerrit.libreoffice.org/46358
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 37a3b2bd44ae..118f551cbf4c 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2623,8 +2623,9 @@ void SwFrameFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
         static_cast< const SwAttrSetChg* >(pNew)->GetChgSet()->GetItemState( RES_ANCHOR, false, &tmp );
         if( tmp )
         {
-            assert(static_cast<SwAttrSetChg const*>(pNew)->GetTheChgdSet() == &m_aSet); // must not be style's set!
             newAnchorPosition = static_cast< const SwFormatAnchor* >( tmp )->GetContentAnchor();
+            assert(newAnchorPosition == nullptr || // style's set must not contain position!
+                static_cast<SwAttrSetChg const*>(pNew)->GetTheChgdSet() == &m_aSet);
         }
     }
     if( pNew && pNew->Which() == RES_ANCHOR )
@@ -2635,8 +2636,9 @@ void SwFrameFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
         static_cast< const SwAttrSetChg* >(pOld)->GetChgSet()->GetItemState( RES_ANCHOR, false, &tmp );
         if( tmp )
         {
-            assert(static_cast<SwAttrSetChg const*>(pOld)->GetTheChgdSet() == &m_aSet); // must not be style's set!
             oldAnchorPosition = static_cast< const SwFormatAnchor* >( tmp )->GetContentAnchor();
+            assert(oldAnchorPosition == nullptr || // style's set must not contain position!
+                static_cast<SwAttrSetChg const*>(pOld)->GetTheChgdSet() == &m_aSet);
         }
     }
     if( pOld && pOld->Which() == RES_ANCHOR )


More information about the Libreoffice-commits mailing list