X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fboost.C;h=10494e226ad8ed57d0d0c36101edfed264d08906;hb=17cc48720a11a3ed65d9de29d5e7a2d29f9a41f0;hp=74c200bdbfb0679ac8acfc20f08add0ce7b670b7;hpb=92d522b7f1be6046adcac062c558bbf0bf021612;p=lyx.git diff --git a/src/boost.C b/src/boost.C index 74c200bdbf..10494e226a 100644 --- a/src/boost.C +++ b/src/boost.C @@ -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 +#include "lyx_main.h" #include "debug.h" -#include "support/LAssert.h" +#include "support/lyxlib.h" -#include +#include -using namespace lyx::support; +#include 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(); }