X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fboost.C;h=ff420ec555311da2a44d247c96dd3096e4951ec3;hb=b817032684f9ac8c639c013ddcc266ee5d8eed45;hp=74c200bdbfb0679ac8acfc20f08add0ce7b670b7;hpb=92d522b7f1be6046adcac062c558bbf0bf021612;p=lyx.git diff --git a/src/boost.C b/src/boost.C index 74c200bdbf..ff420ec555 100644 --- a/src/boost.C +++ b/src/boost.C @@ -1,22 +1,59 @@ +/** + * \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; +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; - Assert(false); + BOOST_ASSERT(false); } +#endif + + +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(); +} + +} // namespace boost