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

Noel Grandin noel at peralex.com
Thu Oct 20 09:15:34 UTC 2016


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

New commits:
commit 85b5ef2809dfea18cdad4700f7a46e864c70726c
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Oct 20 11:14:00 2016 +0200

    revert part of "simplify some use of typeid"
    
    commit 553ee72041d6f66e26156eb1ad0d9e3c13457f7a is wrong in that typeid
    has different semantics to dynamic_cast i.e. is-exactly vs. is-exactly-
    or-subtype
    
    checked the other cases to make sure that non of them have any
    subclasses
    
    Change-Id: Id045e6d5e80aa1f7ba29a3475514eb0ae5320806

diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 4f554ba..f8eb4a5 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -664,15 +664,17 @@ void SwFormatPageDesc::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew
         case RES_OBJECTDYING:
                 //The Pagedesc where I'm registered dies, therefore I unregister
                 //from that format. During this I get deleted!
-            if( auto pSwFormat = dynamic_cast<SwFormat*>(pDefinedIn) )
+            if( typeid(SwFormat) == typeid( pDefinedIn ))
             {
-                bool const bResult = pSwFormat->ResetFormatAttr(RES_PAGEDESC);
+                bool const bResult =
+                    static_cast<SwFormat*>(pDefinedIn)->ResetFormatAttr(RES_PAGEDESC);
                 OSL_ENSURE( bResult, "FormatPageDesc not deleted" );
                 (void) bResult; // unused in non-debug
             }
-            else if( auto pSwContentNode = dynamic_cast<SwContentNode*>(pDefinedIn) )
+            else if( typeid(SwContentNode) == typeid( pDefinedIn ))
             {
-                bool const bResult = pSwContentNode->ResetAttr(RES_PAGEDESC);
+                bool const bResult = static_cast<SwContentNode*>(pDefinedIn)
+                        ->ResetAttr(RES_PAGEDESC);
                 OSL_ENSURE( bResult, "FormatPageDesc not deleted" );
                 (void) bResult; // unused in non-debug
             }


More information about the Libreoffice-commits mailing list