X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fboost.C;h=ff420ec555311da2a44d247c96dd3096e4951ec3;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=f16fcfe92f46e4afab46d71ef5ba3b061285b601;hpb=0be0fcfd5907d448cd51addf83ed7032719a0692;p=lyx.git diff --git a/src/boost.C b/src/boost.C index f16fcfe92f..ff420ec555 100644 --- a/src/boost.C +++ b/src/boost.C @@ -10,23 +10,50 @@ #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