[Libreoffice-commits] core.git: 7 commits - sc/source sw/inc sw/source vcl/source

Stephan Bergmann sbergman at redhat.com
Wed Mar 4 04:56:55 PST 2015


 sc/source/core/data/stlsheet.cxx   |   17 ++++++++++++-----
 sw/inc/docary.hxx                  |    6 ++++--
 sw/source/core/layout/fly.cxx      |    4 ++++
 sw/source/core/layout/flyincnt.cxx |    4 ++++
 sw/source/core/layout/pagechg.cxx  |    4 ++++
 sw/source/core/layout/wsfrm.cxx    |   10 +++-------
 vcl/source/window/syswin.cxx       |    3 +++
 7 files changed, 34 insertions(+), 14 deletions(-)

New commits:
commit 0f98299f7aa44bbb55c1bfeddca7799f727d14b0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 4 13:52:03 2015 +0100

    Avoid bad downcast of SwFrmFmt to SwSectionFmt
    
    as observed by -fsanitize=vptr e.g. during CppunitTest_writerperfect_writer:
    
    SwFmtsModifyBase<SwSectionFmt*>::Contains(SwFmt const*) const
    SwUndoFmtAttr::Init()
    SwUndoFmtAttr::SwUndoFmtAttr(SfxItemSet const&, SwFmt&, bool)
    SwDoc::ChgFmt(SwFmt&, SfxItemSet const&)
    SwDocStyleSheet::SetItemSet(SfxItemSet const&, bool)
    SwXStyle::SetPropertyValues_Impl(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)
    SwXStyle::setPropertyValues(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)
    SvXMLImportPropertyMapper::_FillMultiPropertySet(std::__debug::vector<XMLPropertyState, std::allocator<XMLPropertyState> > const&, com::sun::star::uno::Reference<com::sun::star::beans::XMultiPropertySet> const&, com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> const&, rtl::Reference<XMLPropertySetMapper> const&, _ContextID_Index_Pair*)
    SvXMLImportPropertyMapper::FillPropertySet(std::__debug::vector<XMLPropertyState, std::allocator<XMLPropertyState> > const&, com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>, _ContextID_Index_Pair*) const
    XMLShapeStyleContext::FillPropertySet(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&)
    XMLPropStyleContext::CreateAndInsert(bool)
    XMLTextShapeStyleContext::CreateAndInsert(bool)
    SvXMLStylesContext::CopyStylesToDoc(bool, bool)
    SwXMLImport::InsertStyles(bool)
    SwXMLStylesContext_Impl::EndElement()
    SvXMLImport::endElement(rtl::OUString const&)
    ...
    
    Change-Id: Ibbf6d4def751c5a8ad1416e22b8b5255eda3dd44

diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 098851e..8768cc0 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -128,8 +128,10 @@ public:
 
     inline sal_uInt16 GetPos(const SwFmt *p) const
         { return SwVectorModifyBase<Value>::GetPos( static_cast<Value>( const_cast<SwFmt*>( p ) ) ); }
-    inline bool Contains(const SwFmt *p) const
-        { return SwVectorModifyBase<Value>::Contains( static_cast<Value>( const_cast<SwFmt*>( p ) ) ); }
+    inline bool Contains(const SwFmt *p) const {
+        Value p2 = dynamic_cast<Value>(const_cast<SwFmt*>(p));
+        return p2 != nullptr && SwVectorModifyBase<Value>::Contains(p2);
+    }
 };
 
 class SwGrfFmtColls : public SwFmtsModifyBase<SwGrfFmtColl*>
commit dedc93e973b59ca4d1660fc3820770bf9b072896
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 4 13:43:49 2015 +0100

    Hack to work around an in-destruction SwTxtNode no longer being one
    
    as observed by -fsanitize=vptr e.g. during CppunitTest_sw_mailmerge (though the
    true fix might be to prevent all this from happening during ~SwTxtNode anyway?):
    
    SwTxtFrm::GetTxtNode() const
    SwFrm::InvalidatePage(SwPageFrm const*) const
    SwCntntFrm::Cut()
    SwCntntNode::DelFrms(bool)
    SwCntntNode::~SwCntntNode()
    SwTxtNode::~SwTxtNode()
    SwNodes::RemoveNode(unsigned long, unsigned long, bool)
    SwNodes::Delete(SwNodeIndex const&, unsigned long)
    SwDoc::AppendDoc(SwDoc const&, unsigned short, SwPageDesc*, bool, int)
    ...
    
    Change-Id: Ic3bdf067abba985a0b95d4f0a482a94098341198

diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index d6ee2fa..aea4702 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -435,13 +435,9 @@ void SwFrm::InvalidatePage( const SwPageFrm *pPage ) const
         }
         pRoot->SetIdleFlags();
 
-        const SwTxtFrm *pTxtFrm = dynamic_cast< const SwTxtFrm * >(this);
-        if (pTxtFrm)
-        {
-            const SwTxtNode *pTxtNode = pTxtFrm->GetTxtNode();
-            if (pTxtNode && pTxtNode->IsGrammarCheckDirty())
-                pRoot->SetNeedGrammarCheck( true );
-        }
+        const SwTxtNode *pTxtNode = dynamic_cast< const SwTxtNode * >(GetDep());
+        if (pTxtNode && pTxtNode->IsGrammarCheckDirty())
+            pRoot->SetNeedGrammarCheck( true );
     }
 }
 
commit db2c0dc78f11c2764f16e7ca4edaf2cdffc56c64
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 4 13:34:52 2015 +0100

    Hack to make an in-destruction SwPageFrm no longer claim to be one
    
    as observed by -fsanitize=vptr e.g. during CppunitTest_sw_mailmerge (though the
    true fix might be to prevent all this from happening during ~SwPageFrm anyway?):
    
    SwFrm::FindPageFrm()
    SwAnchoredObject::FindPageFrmOfAnchor()
    lcl_NotifyBackgroundOfObj(SwDrawContact&, SdrObject const&, Rectangle const*)
    SwDrawContact::DisconnectFromLayout(bool)
    SwDrawContact::DisconnectObjFromLayout(SdrObject*)
    SwLayoutFrm::Destroy()
    SwLayoutFrm::~SwLayoutFrm()
    SwFtnBossFrm::~SwFtnBossFrm()
    SwPageFrm::~SwPageFrm()
    SwFrm::CheckPageDescs(SwPageFrm*, bool, SwPageFrm**)
    SwFlowFrm::MoveBwd(bool&)
    SwCntntFrm::MakeAll()
    SwFrm::PrepareMake()
    SwFrm::Calc()
    SwLayAction::IsShortCut(SwPageFrm*&)
    SwLayAction::InternalAction()
    SwLayAction::Action()
    SwViewShell::ImplEndAction(bool)
    SwViewShell::EndAction(bool)
    SwCrsrShell::EndAction(bool, bool)
    SwEditShell::EndAllAction()
    SwDoc::AppendDoc(SwDoc const&, unsigned short, SwPageDesc*, bool)
    ...
    
    Change-Id: Iac207ef4a80318609f0a00d219dcccacaee7b205

diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 60c1f06..f65afbc 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -263,6 +263,10 @@ SwPageFrm::~SwPageFrm()
             }
         }
     }
+
+    // Hack to make sure code called from base ~SwFtnBossFrm does not interpret
+    // this as a SwPageFrm (which it no longer is by then):
+    mnFrmType = FRM_UNUSED;
 }
 
 void SwPageFrm::CheckGrid( bool bInvalidate )
commit e49ca69747e9e905dbb00bbd5a7ea85331607a04
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 4 13:30:09 2015 +0100

    Hack to make an in-destruction SwFlyInCntFrm no longer claim to be one
    
    as observed by -fsanitize=vptr e.g. during CppunitTest_sw_uiwriter (though the
    true fix might be to prevent all this from happening during ~SwFlyInFrm
    anyway?):
    
    SwFrm::InvalidatePage(SwPageFrm const*)
    SwFlyFrm::DeleteCnt()
    SwFlyFrm::~SwFlyFrm()
    SwFlyInCntFrm::~SwFlyInCntFrm()
    SwFrmFmt::DelFrms()
    SwUndoFlyBase::DelFly(SwDoc*)
    SwUndoDelLayFmt::SwUndoDelLayFmt(SwFrmFmt*)
    SwHistoryTxtFlyCnt::SwHistoryTxtFlyCnt(SwFrmFmt*)
    SwHistory::Add(SwTxtAttr*, unsigned long, bool)
    SwUndoSaveCntnt::DelCntntIndex(SwPosition const&, SwPosition const&, unsigned short)
    SwUndoDelete::SwUndoDelete(SwPaM&, bool, bool)
    sw::DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM&)
    sw::DocumentContentOperationsManager::DeleteRangeImpl(SwPaM&, bool)
    sw::DocumentContentOperationsManager::DeleteAndJoinImpl(SwPaM&, bool)
    (anonymous namespace)::lcl_DoWithBreaks(sw::DocumentContentOperationsManager&, SwPaM&, bool (sw::DocumentContentOperationsManager::*)(SwPaM&, bool), bool)
    sw::DocumentContentOperationsManager::DeleteAndJoin(SwPaM&, bool)
    SwEditShell::DeleteSel(SwPaM&, bool*)
    SwEditShell::Delete()
    ...
    
    Change-Id: I6e3d7f3ab9f11a46324826201bc1af9a2d3a88cb

diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx
index 2a9c885..10d15ac 100644
--- a/sw/source/core/layout/flyincnt.cxx
+++ b/sw/source/core/layout/flyincnt.cxx
@@ -48,6 +48,10 @@ SwFlyInCntFrm::~SwFlyInCntFrm()
         SwRect aTmp( GetObjRectWithSpaces() );
         SwFlyInCntFrm::NotifyBackground( FindPageFrm(), aTmp, PREP_FLY_LEAVE );
     }
+
+    // Hack to make sure code called from base ~SwFlyFrm does not interpret this
+    // as a SwFlyFrm (which it no longer is by then):
+    mnFrmType = FRM_UNUSED;
 }
 
 // #i28701#
commit 5a934b2c6085d4e397e1466f8cd6a813f3c2d9d6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 4 13:20:21 2015 +0100

    Hack to make an in-destruction SwFlyFrm no longer claim to be one
    
    as observed by -fsanitize=vptr e.g. during CppunitTest_writerperfect_writer
    (though the true fix might be to prevent all this from happening during
    ~SwFlyFrm anyway?):
    
    SwFrm::FindPageFrm()
    SwAnchoredObject::FindPageFrmOfAnchor()
    lcl_NotifyBackgroundOfObj(SwDrawContact&, SdrObject const&, Rectangle const*)
    SwDrawContact::DisconnectFromLayout(bool)
    SwDrawContact::DisconnectObjFromLayout(SdrObject*)
    SwLayoutFrm::Destroy()
    SwLayoutFrm::~SwLayoutFrm()
    SwFlyFrm::~SwFlyFrm()
    SwFlyFreeFrm::~SwFlyFreeFrm()
    SwFlyLayFrm::~SwFlyLayFrm()
    SwLayoutFrm::Destroy()
    SwRootFrm::~SwRootFrm()
    ...
    boost::shared_ptr<SwRootFrm>::~shared_ptr()
    SwViewShell::~SwViewShell()
    SwCrsrShell::~SwCrsrShell()
    SwEditShell::~SwEditShell()
    SwFEShell::~SwFEShell()
    SwWrtShell::~SwWrtShell()
    SwView::~SwView()
    SfxViewFrame::ReleaseObjectShell_Impl()
    SfxViewFrame::~SfxViewFrame()
    SfxViewFrame::Close()
    ...
    
    Change-Id: I56d7135044e8682eeaf6ef23c76d4d7beca1eff4

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 529d194..8e788e0 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -268,6 +268,10 @@ SwFlyFrm::~SwFlyFrm()
     }
 
     FinitDrawObj();
+
+    // Hack to make sure code called from base ~SwLayoutFrm does not interpret
+    // this as a SwFlyFrm (which it no longer is by then):
+    mnFrmType = FRM_UNUSED;
 }
 
 const IDocumentDrawModelAccess* SwFlyFrm::getIDocumentDrawModelAccess()
commit a015f2c125ebeff895984ff99267918932df529d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 4 12:01:34 2015 +0100

    Hack to work around an in-destruction ScStyleSheetPool no longer being one
    
    as observed by -fsanitize=vptr e.g. during CppunitTest_sc_filters_test (though
    the true fix might be to prevent all this from happening during
    ~ScStyleSheetPool anyway?):
    
    ScStyleSheet::GetItemSet()
    ScStyleSheet::Notify(SfxBroadcaster&, SfxHint const&)
    SfxBroadcaster::Broadcast(SfxHint const&)
    SfxBroadcaster::~SfxBroadcaster()
    SfxStyleSheet::~SfxStyleSheet()
    ScStyleSheet::~ScStyleSheet()
    cppu::OWeakObject::release()
    comphelper::OWeakTypeObject::release()
    rtl::Reference<SfxStyleSheetBase>::~Reference()
    ...
    std::vector<rtl::Reference<SfxStyleSheetBase>, std::allocator<rtl::Reference<SfxStyleSheetBase>>>::clear()
    svl::IndexedStyleSheets::Clear(svl::StyleSheetDisposer&)
    SfxStyleSheetBasePool::Clear()
    SfxStyleSheetBasePool::~SfxStyleSheetBasePool()
    SfxStyleSheetPool::~SfxStyleSheetPool()
    ScStyleSheetPool::~ScStyleSheetPool()
    cppu::OWeakObject::release()
    comphelper::OWeakTypeObject::release()
    rtl::Reference<ScStyleSheetPool>::clear()
    ScPoolHelper::~ScPoolHelper()
    salhelper::SimpleReferenceObject::release()
    rtl::Reference<ScPoolHelper>::clear()
    ScDocument::~ScDocument()
    ScDocShell::~ScDocShell()
    ...
    
    Change-Id: I1565f8dbd039de20f63ac20d6b86d7b0d2799637

diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx
index 116371a..4ca8070 100644
--- a/sc/source/core/data/stlsheet.cxx
+++ b/sc/source/core/data/stlsheet.cxx
@@ -225,11 +225,18 @@ SfxItemSet& ScStyleSheet::GetItemSet()
     {
         if ( !pSet->Count() )
         {
-            ScDocument* pDoc = static_cast<ScStyleSheetPool&>(GetPool()).GetDocument();
-            if ( pDoc )
-            {
-                sal_uLong nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( css::util::NumberFormat::CURRENCY,ScGlobal::eLnge );
-                pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) );
+            // Hack to work around that when this code is called from
+            // ~ScStyleSheetPool -> ~SfxStyleSheetPool, GetPool() is no longer
+            // an ScStyleSheetPool:
+            ScStyleSheetPool * pool = dynamic_cast<ScStyleSheetPool *>(
+                &GetPool());
+            if (pool != nullptr) {
+                ScDocument* pDoc = pool->GetDocument();
+                if ( pDoc )
+                {
+                    sal_uLong nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( css::util::NumberFormat::CURRENCY,ScGlobal::eLnge );
+                    pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) );
+                }
             }
         }
     }
commit 6449e5bb6dd1f09678e09164ef21f455132af98f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 4 11:52:16 2015 +0100

    Hack to make an in-destruction SystemWindow no longer claim to be one
    
    as observed by -fsanitize=vptr e.g. during CppunitTest_sc_macros_test (though
    the true fix might be to prevent all this from happening during ~SystemWindow
    anyway?):
    
    vcl::ImplGetLastSystemWindow(vcl::Window*)
    vcl::Window::SetParent(vcl::Window*)
    vcl::Window::doLazyDelete()
    UnoWrapper::WindowDestroyed(vcl::Window*)
    vcl::Window::~Window()
    SystemWindow::~SystemWindow()
    WorkWindow::~WorkWindow()
    VCLXDevice::DestroyOutputDevice()
    VCLXWindow::dispose()
    (anonymous namespace)::Frame::impl_disposeContainerWindow(com::sun::star::uno::Reference<com::sun::star::awt::XWindow>&)
    (anonymous namespace)::Frame::dispose()
    (anonymous namespace)::Frame::close(unsigned char)
    non-virtual thunk to (anonymous namespace)::Frame::close(unsigned char)
    SfxFrame::DoClose()
    ...
    
    Change-Id: I91495eaa3cb2c636fd093ae7eb8b6ae4733002bb

diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 5c953f3..dde7bc9 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -109,6 +109,9 @@ SystemWindow::~SystemWindow()
     maLayoutIdle.Stop();
     delete mpImplData;
     mpImplData = NULL;
+    // Hack to make sure code called from base ~Window does not interpret this
+    // as a SystemWindow (which it no longer is by then):
+    mpWindowImpl->mbSysWin = false;
 }
 
 bool SystemWindow::Notify( NotifyEvent& rNEvt )


More information about the Libreoffice-commits mailing list