From 85b5ef2809dfea18cdad4700f7a46e864c70726c Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 20 Oct 2016 11:14:00 +0200 Subject: 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 --- sw/source/core/layout/atrfrm.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 4f554babfd6a..f8eb4a5505f2 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(pDefinedIn) ) + if( typeid(SwFormat) == typeid( pDefinedIn )) { - bool const bResult = pSwFormat->ResetFormatAttr(RES_PAGEDESC); + bool const bResult = + static_cast(pDefinedIn)->ResetFormatAttr(RES_PAGEDESC); OSL_ENSURE( bResult, "FormatPageDesc not deleted" ); (void) bResult; // unused in non-debug } - else if( auto pSwContentNode = dynamic_cast(pDefinedIn) ) + else if( typeid(SwContentNode) == typeid( pDefinedIn )) { - bool const bResult = pSwContentNode->ResetAttr(RES_PAGEDESC); + bool const bResult = static_cast(pDefinedIn) + ->ResetAttr(RES_PAGEDESC); OSL_ENSURE( bResult, "FormatPageDesc not deleted" ); (void) bResult; // unused in non-debug } -- cgit