fix another crash like bug #6303

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36796 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2010-12-09 21:35:39 +00:00
parent a03d15bbdd
commit d0933f4bd9

View File

@ -2475,6 +2475,7 @@ bool GuiView::closeBuffer(Buffer & buf)
// so no need to do it here. This will ensure that the children end up // so no need to do it here. This will ensure that the children end up
// in the session file in the correct order. If we close the master // in the session file in the correct order. If we close the master
// buffer, we can close or release the child buffers here too. // buffer, we can close or release the child buffers here too.
bool success = true;
if (!closing_) { if (!closing_) {
ListOfBuffers clist = buf.getChildren(); ListOfBuffers clist = buf.getChildren();
ListOfBuffers::const_iterator it = clist.begin(); ListOfBuffers::const_iterator it = clist.begin();
@ -2486,22 +2487,26 @@ bool GuiView::closeBuffer(Buffer & buf)
Buffer * child_buf = *it; Buffer * child_buf = *it;
GuiWorkArea * child_wa = workArea(*child_buf); GuiWorkArea * child_wa = workArea(*child_buf);
if (child_wa) { if (child_wa) {
if (!closeWorkArea(child_wa, true)) if (!closeWorkArea(child_wa, true)) {
return false; success = false;
break;
}
} else } else
theBufferList().releaseChild(&buf, child_buf); theBufferList().releaseChild(&buf, child_buf);
} }
} }
// goto bookmark to update bookmark pit. if (success) {
//FIXME: we should update only the bookmarks related to this buffer! // goto bookmark to update bookmark pit.
LYXERR(Debug::DEBUG, "GuiView::closeBuffer()"); //FIXME: we should update only the bookmarks related to this buffer!
for (size_t i = 0; i < theSession().bookmarks().size(); ++i) LYXERR(Debug::DEBUG, "GuiView::closeBuffer()");
guiApp->gotoBookmark(i+1, false, false); for (size_t i = 0; i < theSession().bookmarks().size(); ++i)
guiApp->gotoBookmark(i+1, false, false);
if (saveBufferIfNeeded(buf, false)) { if (saveBufferIfNeeded(buf, false)) {
buf.removeAutosaveFile(); buf.removeAutosaveFile();
theBufferList().release(&buf); theBufferList().release(&buf);
return true; return true;
}
} }
// open all children again to avoid a crash (bug 6603) // open all children again to avoid a crash (bug 6603)
// FIXME updateMacros() does more than needed // FIXME updateMacros() does more than needed