From: Abdelrazak Younes Date: Wed, 28 Mar 2007 16:01:32 +0000 (+0000) Subject: Fix bug 3356 by Bernhard Roider: X-Git-Tag: 1.6.10~10444 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=ae4db7543fdec91ceb8a888d314b0d5feb6d386d;p=features.git Fix bug 3356 by Bernhard Roider: The crash happens on alt+up and alt+down if the position of the cursor in the moved paragraph is beyond the length of the target paragraph. To avoid it the Position of the iterators for the target paragraph must be corrected. I set it to 0 as i assume it is not really used. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17613 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/text3.C b/src/text3.C index 94827a2713..6dac2facf7 100644 --- a/src/text3.C +++ b/src/text3.C @@ -333,6 +333,10 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) std::swap(pars_[pit], pars_[pit + 1]); ParIterator begin(cur); + // begin.pos() (== cur.pos()) may point beyond the end of the + // paragraph referenced by begin. This would cause a crash + // in updateLabels() + begin.pos() = 0; ++cur.pit(); ParIterator end = boost::next(ParIterator(cur)); updateLabels(cur.buffer(), begin, end); @@ -347,7 +351,12 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) finishUndo(); std::swap(pars_[pit], pars_[pit - 1]); - ParIterator end = boost::next(ParIterator(cur)); + ParIterator end = ParIterator(cur); + // end.pos() (== cur.pos()) may point beyond the end of the + // paragraph referenced by end. This would cause a crash + // in boost::next() + end.pos() = 0; + end = boost::next(end); --cur.pit(); ParIterator begin(cur); updateLabels(cur.buffer(), begin, end);