summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-08-04 16:11:12 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-08-04 16:16:03 +0200
commit4ef4cf11c0c214e27fdc91ac75ccc49bfac05e71 (patch)
treeae9ca8b59bf960998e70ed74961146ba3f39c110
parentb8423c4f83542f27010ebbdceda45aec6585325b (diff)
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
-rw-r--r--sw/source/core/attr/format.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index ddd183e33d91..9af7f6a9cc20 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 );