added poco_unexpected() macro invoking Bugcheck::unexpected() to deal with unexpected exceptions in destructors

This commit is contained in:
Guenter Obiltschnig
2014-09-19 08:16:47 +02:00
parent 9ad81fd6a2
commit e500d0f31a
2 changed files with 41 additions and 4 deletions

View File

@@ -57,6 +57,35 @@ void Bugcheck::bugcheck(const char* msg, const char* file, int line)
}
void Bugcheck::unexpected(const char* file, int line)
{
try
{
std::string msg("Caught exception in destructor: ");
try
{
throw;
}
catch (Poco::Exception& exc)
{
msg += exc.displayText();
}
catch (std::exception& exc)
{
msg += exc.what();
}
catch (...)
{
msg += "unknown exception";
}
Debugger::enter(msg, file, line);
}
catch (...)
{
}
}
void Bugcheck::debugger(const char* file, int line)
{
Debugger::enter(file, line);
@@ -78,6 +107,4 @@ std::string Bugcheck::what(const char* msg, const char* file, int line)
}
} // namespace Poco