mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix outliner crash reported by Vincent.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29583 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3d67112a10
commit
6537f7aca0
@ -311,12 +311,12 @@ static void outline(OutlineOp mode, Cursor & cur)
|
||||
Buffer & buf = *cur.buffer();
|
||||
pit_type & pit = cur.pit();
|
||||
ParagraphList & pars = buf.text().paragraphs();
|
||||
ParagraphList::iterator bgn = pars.begin();
|
||||
ParagraphList::iterator const bgn = pars.begin();
|
||||
// The first paragraph of the area to be copied:
|
||||
ParagraphList::iterator start = boost::next(bgn, pit);
|
||||
// The final paragraph of area to be copied:
|
||||
ParagraphList::iterator finish = start;
|
||||
ParagraphList::iterator end = pars.end();
|
||||
ParagraphList::iterator const end = pars.end();
|
||||
|
||||
DocumentClass const & tc = buf.params().documentClass();
|
||||
|
||||
@ -333,6 +333,10 @@ static void outline(OutlineOp mode, Cursor & cur)
|
||||
break;
|
||||
}
|
||||
|
||||
// Do we need to set insets' buffer_ members, because we copied
|
||||
// some stuff? We'll assume we do and reset it otherwise.
|
||||
bool setBuffers = true;
|
||||
|
||||
switch (mode) {
|
||||
case OutlineUp: {
|
||||
if (start == pars.begin())
|
||||
@ -360,7 +364,7 @@ static void outline(OutlineOp mode, Cursor & cur)
|
||||
start = boost::next(pars.begin(), deletepit);
|
||||
pit = newpit;
|
||||
pars.erase(start, finish);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
case OutlineDown: {
|
||||
if (finish == end)
|
||||
@ -383,7 +387,7 @@ static void outline(OutlineOp mode, Cursor & cur)
|
||||
start = boost::next(bgn, pit);
|
||||
pit = newpit - len;
|
||||
pars.erase(start, finish);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
case OutlineIn: {
|
||||
pit_type const len = distance(start, finish);
|
||||
@ -402,7 +406,8 @@ static void outline(OutlineOp mode, Cursor & cur)
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
setBuffers = false;
|
||||
break;
|
||||
}
|
||||
case OutlineOut: {
|
||||
pit_type const len = distance(start, finish);
|
||||
@ -421,9 +426,20 @@ static void outline(OutlineOp mode, Cursor & cur)
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
setBuffers = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (setBuffers)
|
||||
// FIXME This only really needs doing for the newly introduced
|
||||
// paragraphs. Something like:
|
||||
// pit_type const numpars = distance(start, finish);
|
||||
// start = boost::next(bgn, pit);
|
||||
// finish = boost::next(start, numpars);
|
||||
// for (; start != finish; ++start)
|
||||
// start->setBuffer(buf);
|
||||
// But while this seems to work, it is kind of fragile.
|
||||
buf.inset().setBuffer(buf);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user