]> git.lyx.org Git - features.git/commitdiff
When cleaning up before quitting, take care of exceptions
authorJean-Marc Lasgouttes <jean-marc.lasgouttes@inria.fr>
Tue, 11 Jul 2017 13:28:06 +0000 (15:28 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 11 Jul 2017 13:30:32 +0000 (15:30 +0200)
We do not want the cleanup work to be interrupted by a buffer exception.

Spotted by coverity. See bug #9979 for discussion.

src/LyX.cpp

index bb88f82dbbb08fd8930125fdd8ac213c2dd99c04..0a0a31959b9c8de262b8f71a0e479019edb9f7e1 100644 (file)
@@ -419,8 +419,12 @@ void LyX::prepareExit()
        // Write the index file of the converter cache
        ConverterCache::get().writeIndex();
 
-       // close buffers first
-       pimpl_->buffer_list_.closeAll();
+       // closing buffer may throw exceptions, but we ignore them since we
+       // are quitting.
+       try {
+               // close buffers first
+               pimpl_->buffer_list_.closeAll();
+       } catch (ExceptionMessage const &) {}
 
        // register session changes and shutdown server and socket
        if (use_gui) {