X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fboost.C;h=10494e226ad8ed57d0d0c36101edfed264d08906;hb=37e82a546392d43f787826b85481a11f2a27af15;hp=ef997c801c836d25164aa05902e2bc79ae83df0d;hpb=5d443af86a79f7d58098fe574bd034e320292c00;p=lyx.git diff --git a/src/boost.C b/src/boost.C index ef997c801c..10494e226a 100644 --- a/src/boost.C +++ b/src/boost.C @@ -1,7 +1,20 @@ +/** + * \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 @@ -13,7 +26,34 @@ void throw_exception(std::exception const & e) { lyxerr << "Exception caught:\n" << e.what() << endl; - lyx::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(); }