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

Stephan Bergmann sbergman at redhat.com
Wed Feb 25 03:18:32 PST 2015


 sw/source/core/doc/docftn.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0316c6c2d32245bad601aa74d8e42b21a427f9d2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Feb 25 12:14:17 2015 +0100

    Avoid unnecessary bad downcasts to SwCharFmt
    
    At least in JunitTest_sw_unoapi it happens that this downcast is called from
    ~SwCharFmt -> ~SwFmt -> SwClient::ModifyNotification -> SwDepend::Modify ->
    SwClient::ModifyNotification -> SwEndNodeInfo::Modify, i.e., the downcasted
    object is in destruction and no longer an SwCharFmt but only an SwFmt.  Whether
    or not that chain of calls is actually sane---casting down to merely an SwFmt
    is a quickfix at least.
    
    Change-Id: I33f0d76c42daa2530b8d417df059de57190c5070

diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index e440e0a..1b9c1be 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -193,9 +193,9 @@ void SwEndNoteInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
     {
         SwDoc* pDoc;
         if( aCharFmtDep.GetRegisteredIn() )
-            pDoc = static_cast<SwCharFmt*>(aCharFmtDep.GetRegisteredIn())->GetDoc();
+            pDoc = static_cast<SwFmt*>(aCharFmtDep.GetRegisteredIn())->GetDoc();
         else
-            pDoc = static_cast<SwCharFmt*>(aAnchorCharFmtDep.GetRegisteredIn())->GetDoc();
+            pDoc = static_cast<SwFmt*>(aAnchorCharFmtDep.GetRegisteredIn())->GetDoc();
         SwFtnIdxs& rFtnIdxs = pDoc->GetFtnIdxs();
         for( size_t nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
         {


More information about the Libreoffice-commits mailing list