Hello,
I reproduced the problem indicated by fdo#48683, attached :
- bt with symbols
(https://bugs.freedesktop.org/attachment.cgi?id=59969&action=edit)
- valgrind logs
(https://bugs.freedesktop.org/attachment.cgi?id=59970&action=edit)
Here are the lines of editeng/source/editeng/impedit3.cxx which seem to
cause the problem :
2421 TextPortion* pTP = 0;
2422 for ( nPortion = 0; nPortion < nPortions; nPortion++ )
2423 {
2424 pTP = pParaPortion->GetTextPortions()[ nPortion ];
2425 if ( ( nPos+pTP->GetLen() ) > nStartPos )
2426 {
2427 DBG_ASSERT( nPos <= nStartPos, "Wrong Start!" );
2428 DBG_ASSERT( nPos+pTP->GetLen() >= nEnd, "Wrong End!"
);
2429 break;
2430 }
2431 nPos = nPos + pTP->GetLen();
2432 }
2433 DBG_ASSERT( pTP, "RecalcTextPortion: Portion not found" );
2434 if ( ( nPos == nStartPos ) && ( (nPos+pTP->GetLen()) == nEnd
) )
2435 {
2436 // Remove portion;
2437 sal_uInt8 nType = pTP->GetKind();
2438 pParaPortion->GetTextPortions().Remove( nPortion );
2439 delete pTP;
Since pTP corresponds to the address of pParaPortion->GetTextPortions()[
nPortion ]
I wonder if these both lines wouldn't be incompatible:
- pParaPortion->GetTextPortions().Remove( nPortion );
- delete pTP;
So I propose this easy fix:
diff --git a/editeng/source/editeng/impedit3.cxx
b/editeng/source/editeng/impedit3.cxx
index 0d6877b..2c557da 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2436,7 +2436,6 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion*
pParaPortion, sal_uInt16 nSt
// Remove portion;
sal_uInt8 nType = pTP->GetKind();
pParaPortion->GetTextPortions().Remove( nPortion );
- delete pTP;
if ( nType == PORTIONKIND_LINEBREAK )
{
TextPortion* pNext = pParaPortion->GetTextPortions()[
nPortion ];
I can commit and push on master of course but I'd like first your opinion
about this since I could missed something.
Julien.
--
View this message in context:
http://nabble.documentfoundation.org/PATCH-fix-proposed-for-fdo-48683-tp3910199p3910199.html
Sent from the Dev mailing list archive at Nabble.com.
Context
- [PATCH] fix proposed for fdo#48683 · julien2412
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.