]> git.lyx.org Git - lyx.git/blobdiff - src/boost.C
Make enter button work in GTK text dialog
[lyx.git] / src / boost.C
index 74c200bdbfb0679ac8acfc20f08add0ce7b670b7..10494e226ad8ed57d0d0c36101edfed264d08906 100644 (file)
@@ -1,11 +1,22 @@
+/**
+ * \file boost.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
 #include <config.h>
 
+#include "lyx_main.h"
 #include "debug.h"
-#include "support/LAssert.h"
+#include "support/lyxlib.h"
 
-#include <exception>
+#include <boost/assert.hpp>
 
-using namespace lyx::support;
+#include <exception>
 
 using std::endl;
 
@@ -15,7 +26,34 @@ void throw_exception(std::exception const & e)
 {
        lyxerr << "Exception caught:\n"
            << e.what() << endl;
-       Assert(false);
+       BOOST_ASSERT(false);
+}
+
+
+namespace {
+
+void emergencyCleanup()
+{
+       static bool didCleanup;
+       if (didCleanup)
+               return;
+
+       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 failing check \"" << expr << "\""
+              << " in file " << file << ":" << line << endl;
+       emergencyCleanup();
+       lyx::support::abort();
 }