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

New commits:
commit 1e70464c380ecc0756ea29098632c503a60aec71
Author: Michael Stahl <mst...@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

diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 207cb77d1954..2b15de1ffcd3 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2615,8 +2615,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 )
@@ -2627,8 +2628,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 )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to