On Mon, 2011-11-28 at 12:51 +0100, Michael Stahl wrote: > finally, i have deployed our new aborting assertions for some definitely > wrong cases in SwIndex: > http://cgit.freedesktop.org/libreoffice/core/commit/?id=0d2a6999fc320843e4db0c99d961414416a8451c
And I have abort on make subsequentcheck in writer on getting the anchor for an embeddedobj, i.e. sw.SwXTextEmbeddedObject test Here's what I see... in __GI___assert_fail (assertion=0x7fffdbf615b8 "m_pIndexReg == rIndex.m_pIndexReg", file=0x7fffdbf61278 "/home/caolan/LibreOffice/core/sw/source/core/bastyp/index.cxx", line=382, function= 0x7fffdbf616a0 "bool SwIndex::operator<(const SwIndex&) const") at assert.c:105 Digging, I see the m_pIndexReg is zero-ed out at... SwFmtAnchor::SetAnchor (this=0x7fffdd1ac6a0, pPos=0x7fffdd1ac958) at /home/caolan/LibreOffice/core/sw/source/core/layout/atrfrm.cxx:1508 fuller logs attached. The zeroing out code is... void SwFmtAnchor::SetAnchor( const SwPosition *pPos ) { delete pCntntAnchor; pCntntAnchor = pPos ? new SwPosition( *pPos ) : 0; //AM Absatz gebundene Flys sollten nie in den Absatz hineinzeigen. if (pCntntAnchor && ((FLY_AT_PARA == nAnchorId) || (FLY_AT_FLY == nAnchorId))) { pCntntAnchor->nContent.Assign( 0, 0 ); } } So we are a FLY_AT_PARA anchor, so the SwIndex m_pIndexReg is set to 0 from the first arg, comment is in German, but I guess the jist of it is "paragraph anchors shouldn't point into a specific location in the paragraph", which seems plausible. Later on though when we want to find the anchor we end up comparing SwIndex'es and the assert fires, so how do we fix this ? a) Tweak the SwIndex::operator to allow NULL m_pIndexReg when m_nIndex is 0 and sort them before non-NULL m_pIndexReg ? b) Do that in SwPosition::operator< instead ?. c) Not null out the m_pIndexReg in the first place in SetCntntAnchor, and just set it to the 0th element d) custom compare in lcl_MarkOrderingByStart, lcl_Lower etc ? C.
#3 0x0000003a6782dd02 in __GI___assert_fail (assertion=0x7fffdbf615b8 "m_pIndexReg == rIndex.m_pIndexReg", file=0x7fffdbf61278 "/home/caolan/LibreOffice/core/sw/source/core/bastyp/index.cxx", line=382, function= 0x7fffdbf616a0 "bool SwIndex::operator<(const SwIndex&) const") at assert.c:105 #4 0x00007fffdb47e265 in SwIndex::operator< (this=0x22547b8, rIndex=...) at /home/caolan/LibreOffice/core/sw/source/core/bastyp/index.cxx:382 #5 0x00007fffdb4d1126 in SwPosition::operator< (this=0x22547a0, rPos=SwPosition (node 12, offset 0)) at /home/caolan/LibreOffice/core/sw/source/core/crsr/pam.cxx:111 #6 0x00007fffdb524933 in (anonymous namespace)::lcl_MarkOrderingByStart (rpFirst=..., rpSecond=...) at /home/caolan/LibreOffice/core/sw/source/core/doc/docbm.cxx:82 #7 0x00007fffdb530ef2 in __gnu_debug::__check_partitioned_lower<__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<boost::shared_ptr<sw::mark::IMark>*, std::__cxx1998::vector<boost::shared_ptr<sw::mark::IMark>, std::allocator<boost::shared_ptr<sw::mark::IMark> > > >, std::__debug::vector<boost::shared_ptr<sw::mark::IMark>, std::allocator<boost::shared_ptr<sw::mark::IMark> > > >, boost::shared_ptr<sw::mark::IMark>, bool (*)(boost::shared_ptr<sw::mark::IMark> const&, boost::shared_ptr<sw::mark::IMark> const&)> (__first=..., __last=..., __value= ..., __pred= 0x7fffdb5248de <(anonymous namespace)::lcl_MarkOrderingByStart(IDocumentMarkAccess::pMark_t const&, IDocumentMarkAccess::pMark_t const&)>) at /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../include/c++/4.6.1/debug/functions.h:362 #8 0x00007fffdb52e128 in std::lower_bound<__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<boost::shared_ptr<sw::mark::IMark>*, std::__cxx1998::vector<boost::shared_ptr<sw::mark::IMark>, std::allocator<boost::shared_ptr<sw::mark::IMark> > > >, std::__debug::vector<boost::shared_ptr<sw::mark::IMark>, std::allocator<boost::shared_ptr<sw::mark::IMark> > > >, boost::shared_ptr<sw::mark::IMark>, bool (*)(boost::shared_ptr<sw::mark::IMark> const&, boost::shared_ptr<sw::mark::IMark> const&)> (__first=..., __last=..., __val=..., __comp= 0x7fffdb5248de <(anonymous namespace)::lcl_MarkOrderingByStart(IDocumentMarkAccess::pMark_t const&, IDocumentMarkAccess::pMark_t const&)>) at /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../include/c++/4.6.1/bits/stl_algo.h:2406 #9 0x00007fffdb524a14 in (anonymous namespace)::lcl_InsertMarkSorted (io_vMarks=..., pMark=...) at /home/caolan/LibreOffice/core/sw/source/core/doc/docbm.cxx:100 #10 0x00007fffdb526a7f in sw::mark::MarkManager::makeMark (this=0x1d15740, rPaM=SwPaM = {...}, rName="", eType= IDocumentMarkAccess::UNO_BOOKMARK) at /home/caolan/LibreOffice/core/sw/source/core/doc/docbm.cxx:392 #11 0x00007fffdbabf80d in SwXTextRange::SetPositions (this=0x23c0730, rPam=SwPaM = {...}) at /home/caolan/LibreOffice/core/sw/source/core/unocore/unoobj2.cxx:867 #12 0x00007fffdbabf2c6 in SwXTextRange::SwXTextRange (this=0x23c0730, rPam=SwPaM = {...}, xParent=..., eRange= SwXTextRange::RANGE_IN_TEXT) at /home/caolan/LibreOffice/core/sw/source/core/unocore/unoobj2.cxx:828 #13 0x00007fffdbac0c7e in SwXTextRange::CreateXTextRange (rDoc=..., rPos=SwPosition (node 12, offset 0), pMark= 0x0) at /home/caolan/LibreOffice/core/sw/source/core/unocore/unoobj2.cxx:1202 #14 0x00007fffdba8e6fc in SwXFrame::getAnchor (this=0x222cf70) at /home/caolan/LibreOffice/core/sw/source/core/unocore/unoframe.cxx:1982 #15 0x00007fffdba94126 in SwXTextEmbeddedObject::getAnchor (this=0x222cf30) at /home/caolan/LibreOffice/core/sw/source/core/unocore/unoframe.cxx:2915
#0 SwFmtAnchor::SetAnchor (this=0x7fffdd1ac6a0, pPos=0x7fffdd1ac958) at /home/caolan/LibreOffice/core/sw/source/core/layout/atrfrm.cxx:1508 #1 0x00007fffdb58c53b in SwDoc::_MakeFlySection (this=0x1d11d10, rAnchPos=SwPosition (node 12, offset 0), rNode=..., eRequestId=FLY_AT_PARA, pFlySet=0x7fffdd1aca50, pFrmFmt=0x1e4ea80) at /home/caolan/LibreOffice/core/sw/source/core/doc/doclay.cxx:654 #2 0x00007fffdb50b2d6 in SwDoc::_InsNoTxtNode (this=0x1d11d10, rPos=SwPosition (node 12, offset 0), pNode= 0x1e4e920, pFlyAttrSet=0x7fffdd1aca50, pGrfAttrSet=0x0, pFrmFmt=0x1e4ea80) at /home/caolan/LibreOffice/core/sw/source/core/doc/doc.cxx:978 #3 0x00007fffdb50b6a1 in SwDoc::Insert (this=0x1d11d10, rRg=SwPaM = {...}, xObj=..., pFlyAttrSet= 0x7fffdd1aca50, pGrfAttrSet=0x0, pFrmFmt=0x1e4ea80) at /home/caolan/LibreOffice/core/sw/source/core/doc/doc.cxx:1034 #4 0x00007fffdba90001 in SwXFrame::attachToRange (this=0x21e5e80, xTextRange=...) at /home/caolan/LibreOffice/core/sw/source/core/unocore/unoframe.cxx:2281 #5 0x00007fffdba90ab2 in SwXFrame::attach (this=0x21e5e80, xTextRange=...) at /home/caolan/LibreOffice/core/sw/source/core/unocore/unoframe.cxx:2353 #6 0x00007fffdba940e3 in SwXTextEmbeddedObject::attach (this=0x21e5e40, xTextRange=...) at /home/caolan/LibreOffice/core/sw/source/core/unocore/unoframe.cxx:2909 #7 0x00007fffdbb4f065 in SwXText::insertTextContent (this=0x224e1f8, xRange=..., xContent=..., bAbsorb=
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice