]> git.lyx.org Git - lyx.git/blobdiff - src/boost.C
A better fix for bug 675:
[lyx.git] / src / boost.C
index e4d3cf44ed293fc301943ff19854195cf39ccef4..ff420ec555311da2a44d247c96dd3096e4951ec3 100644 (file)
 
 #include "lyx_main.h"
 #include "debug.h"
+#include "support/lyxlib.h"
 
 #include <boost/assert.hpp>
 
 #include <exception>
 
 using std::endl;
+using lyx::lyxerr;
+using lyx::LyX;
 
 namespace boost {
 
+#ifndef BOOST_NO_EXCEPTIONS
 void throw_exception(std::exception const & e)
 {
        lyxerr << "Exception caught:\n"
            << e.what() << endl;
        BOOST_ASSERT(false);
 }
+#endif
 
 
-namespace {
-
 void emergencyCleanup()
 {
-        static bool didCleanup;
-        if (didCleanup)
-                return;
-
-        didCleanup = true;
+       static bool didCleanup;
+       if (didCleanup)
+               return;
 
-        LyX::emergencyCleanup();
-}
+       didCleanup = true;
 
+       LyX::cref().emergencyCleanup();
 }
 
 
 void assertion_failed(char const * expr, char const * function,
                      char const * file, long line)
 {
-       lyxerr << "Assertion triggered in " << function << " by \"" <<
-               expr << " in file " << file << ":" << line << endl;
+       lyxerr << "Assertion triggered in " << function
+              << " by failing check \"" << expr << "\""
+              << " in file " << file << ":" << line << endl;
        emergencyCleanup();
-       assert(false);
+       lyx::support::abort();
 }
 
-
-}
+} // namespace boost