I tried to reproduce bug http://bugzilla.lyx.org/show_bug.cgi?id=2676, but
was not able to reproduce it. Instead I found out that File->Close simply
does not close the file if it has unsaved changes and saving them to disk
did not work. This is bad IMO, so I created the attached patch that fixes
this.
I also removed the quitting check because a) it is not necessary and b) the
user should be informed that something went wrong even if he wants top
quit LyX.
This goes in tomorrow if nobody objects.
Georg
Log:
* src/bufferlist.C
(BufferList::close): Don't ignore unsaved changes if quitting == true
(BufferList::close): Use menuWrite(buf) instead of buf->save(),
because menuWrite tells the user if the file could not be saved and
asks for another name
Index: src/bufferlist.C
===================================================================
--- src/bufferlist.C (Revision 14467)
+++ src/bufferlist.C (Arbeitskopie)
@@ -173,8 +173,7 @@ bool BufferList::close(Buffer * buf, boo
{
BOOST_ASSERT(buf);
- // FIXME: is the quitting check still necessary ?
- if (!ask || buf->isClean() || quitting || buf->paragraphs().empty()) {
+ if (!ask || buf->isClean() || buf->paragraphs().empty()) {
release(buf);
return true;
}
@@ -195,14 +194,12 @@ bool BufferList::close(Buffer * buf, boo
if (buf->isUnnamed()) {
if (!writeAs(buf))
return false;
- } else if (buf->save()) {
- LyX::ref().session().addLastFile(buf->fileName());
- } else {
+ } else if (!menuWrite(buf))
return false;
- }
- } else if (ret == 2) {
+ else
+ return false;
+ } else if (ret == 2)
return false;
- }
if (buf->isUnnamed()) {
removeAutosaveFile(buf->fileName());