Hi All,
This patch will fix fdo#40831 "Writer will crash when searching text with using regular
expressions".
Please review my attached patch.
Bug URL: https://bugs.freedesktop.org/show_bug.cgi?id=40831
I reproduced this bug on LibO 3.4 and 3.5.
This bug occurs when a row or column containing cursor position was removed by substitution.
This patch is to skip the process of returning the position of the cursor,
when the row or column containing cursor position is removed.
My patch is being submitted under LGPLv3+/MPL.
Regards,
Tomofumi Yagi.
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index c27d8f7..fd6c782 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -2091,10 +2091,22 @@ sal_Bool SwCursor::MoveSection( SwWhichSection fnWhichSect,
void SwCursor::RestoreSavePos()
{
- if( pSavePos )
+ // fdo#40831 if you delete the row or column containing pSavePos,
+ // Writer will crash. Work around this.
+ sal_uLong uNodeCount = GetPoint()->nNode.GetNodes().Count();
+ if( pSavePos && pSavePos->nNode <= uNodeCount )
{
GetPoint()->nNode = pSavePos->nNode;
- GetPoint()->nContent.Assign( GetCntntNode(), pSavePos->nCntnt );
+
+ xub_StrLen nIdx = 0;
+ if ( GetCntntNode() )
+ if ( pSavePos->nCntnt <= GetCntntNode()->Len() )
+ nIdx = pSavePos->nCntnt;
+ else
+ nIdx = GetCntntNode()->Len();
+ else
+ nIdx = GetPoint()->nContent.GetIndex(); // Probably, nIdx = 0
+ GetPoint()->nContent.Assign( GetCntntNode(), nIdx );
}
}
Context
- [Libreoffice] [PATCH] fix for fdo#40831 - Writer will crash when searching text with using regular expressions · Tomofumi Yagi
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.