]> git.lyx.org Git - lyx.git/blobdiff - src/BufferList.cpp
Allow dissolution of insets inside mathed
[lyx.git] / src / BufferList.cpp
index ce7e095e8f6204c5ef1b7cbd5f3ab1b874819b60..a7f9661b0684b7fc700df811cc8f432492a2c0b9 100644 (file)
 #include <algorithm>
 #include <functional>
 
-
-namespace lyx {
-
-using support::addName;
-using support::bformat;
-using support::FileName;
-using support::makeDisplayPath;
-using support::onlyFilename;
-using support::removeAutosaveFile;
-using support::package;
-using support::prefixIs;
-
 using boost::bind;
 
 using std::auto_ptr;
@@ -58,6 +46,18 @@ using std::vector;
 using std::back_inserter;
 using std::transform;
 
+
+namespace lyx {
+
+using support::addName;
+using support::bformat;
+using support::FileName;
+using support::makeDisplayPath;
+using support::onlyFilename;
+using support::removeAutosaveFile;
+using support::package;
+using support::prefixIs;
+
 namespace Alert = lyx::frontend::Alert;
 
 
@@ -226,14 +226,10 @@ bool BufferList::close(Buffer * buf, bool const ask)
                                return false;
                } else if (!menuWrite(buf))
                        return false;
-               else
-                       return false;
        } else if (ret == 2)
                return false;
-
-       if (buf->isUnnamed()) {
-               removeAutosaveFile(buf->fileName());
-       }
+               
+       removeAutosaveFile(buf->fileName());
 
        release(buf);
        return true;
@@ -266,7 +262,7 @@ Buffer * BufferList::last()
 }
 
 
-Buffer * BufferList::getBuffer(unsigned int const choice)
+Buffer * BufferList::getBuffer(unsigned int choice)
 {
        if (choice >= bstore.size())
                return 0;
@@ -334,7 +330,9 @@ void BufferList::emergencyWrite(Buffer * buf)
 {
        // Use ::assert to avoid a loop, BOOST_ASSERT ends up calling ::assert
        // compare with 0 to avoid pointer/interger comparison
-       assert(buf != 0);
+       // ::assert(buf != 0);
+       if (!buf)
+               return;
 
        // No need to save if the buffer has not changed.
        if (buf->isClean())