Fix bug #9907: We get a crash if we first close a master buffer one of

whose children is also a child of another buffer, then try to close that
one.

The problem is that we do not check properly to make sure that the child
is not a child of some other buffer. Now we do.

(cherry picked from commit 0407364392)
This commit is contained in:
Richard Heck 2016-01-05 09:53:42 -05:00
parent 3799213096
commit 9d4406268c
2 changed files with 22 additions and 9 deletions

View File

@ -2663,23 +2663,31 @@ bool GuiView::closeBuffer(Buffer & buf)
ListOfBuffers::const_iterator it = clist.begin();
ListOfBuffers::const_iterator const bend = clist.end();
for (; it != bend; ++it) {
// If a child is dirty, do not close
// without user intervention
//FIXME: should we look in other tabworkareas?
Buffer * child_buf = *it;
if (theBufferList().isOthersChild(&buf, child_buf)) {
child_buf->setParent(0);
continue;
}
// FIXME: should we look in other tabworkareas?
// ANSWER: I don't think so. I've tested, and if the child is
// open in some other window, it closes without a problem.
GuiWorkArea * child_wa = workArea(*child_buf);
if (child_wa) {
if (!closeWorkArea(child_wa, true)) {
success = false;
success = closeWorkArea(child_wa, true);
if (!success)
break;
}
} else
theBufferList().releaseChild(&buf, child_buf);
} else {
// In this case the child buffer is open but hidden.
// It therefore should not (MUST NOT) be dirty!
LATTEST(child_buf->isClean());
theBufferList().release(child_buf);
}
}
}
if (success) {
// goto bookmark to update bookmark pit.
//FIXME: we should update only the bookmarks related to this buffer!
// FIXME: we should update only the bookmarks related to this buffer!
LYXERR(Debug::DEBUG, "GuiView::closeBuffer()");
for (size_t i = 0; i < theSession().bookmarks().size(); ++i)
guiApp->gotoBookmark(i+1, false, false);

View File

@ -56,6 +56,8 @@ What's new
- Improved example file for the moderncv document class.
- Updated French translation of Linguistics manual.
* BUILD/INSTALLATION
@ -85,6 +87,9 @@ What's new
- Fix crash when inserting a line in multline math environment (bug 9902).
- Fix crash when closing buffer one of whose children is also a child of
other master (bug 9907).
- Fix automatic insertion of longtable captions (bug 9692).
- Fix setting of nested minipage via the dialog (bug 8716).