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

Stephan Bergmann sbergman at redhat.com
Mon Aug 4 07:16:42 PDT 2014


 sw/source/core/attr/format.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4ef4cf11c0c214e27fdc91ac75ccc49bfac05e71
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Aug 4 16:11:12 2014 +0200

    Avoid invalid downcasts in DerivedFrom() vs. GetRegisteredIn()
    
    ...where SwFmt::DerivedFrom() is defined as
    
      return (SwFmt*)GetRegisteredIn();
    
    and at least some tests like CppunitTest_sw_htmlexport ran into comparisons
    (evaluating to false anyway) against DerivedFrom() for SwFmt instances whose
    pRegisteredIn is merely set to a SwModify, not an SwFmt, via
    
      pDepend->pRegisteredIn = this;
    
    toward the end of SwModify::Add (sw/source/core/attr/calbck.cxx).
    
    Change-Id: I5de59c938b7f40bb9744df5189285fa5e1d5abd7

diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index ddd183e..9af7f6a 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -306,7 +306,7 @@ void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
         // skip my own Modify
         if ( pOldValue && pNewValue &&
             ((SwFmtChg*)pOldValue)->pChangedFmt != this &&
-            ((SwFmtChg*)pNewValue)->pChangedFmt == DerivedFrom() )
+            ((SwFmtChg*)pNewValue)->pChangedFmt == GetRegisteredIn() )
         {
             // attach Set to new parent
             aSet.SetParent( DerivedFrom() ? &DerivedFrom()->aSet : 0 );


More information about the Libreoffice-commits mailing list