mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
parent
f52e998524
commit
e85609ce42
|
@ -19,7 +19,7 @@ SpeechClient::Engines SpeechClient::availableEngines()
|
||||||
const auto sp = new QTextToSpeech( engine_name );
|
const auto sp = new QTextToSpeech( engine_name );
|
||||||
|
|
||||||
#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) )
|
#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) )
|
||||||
if ( !sp || sp->state() == QTextToSpeech::Error )
|
if ( sp->state() == QTextToSpeech::Error )
|
||||||
continue;
|
continue;
|
||||||
#else
|
#else
|
||||||
if ( !sp || sp->state() == QTextToSpeech::BackendError )
|
if ( !sp || sp->state() == QTextToSpeech::BackendError )
|
||||||
|
|
|
@ -9,26 +9,7 @@
|
||||||
|
|
||||||
static void termHandler()
|
static void termHandler()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Trick: In c++17, there is no standardized way to know the exception name/type inside terminate_handler
|
|
||||||
// So, we just get the exception and throw it again, so that we can call the std::exception::what :)
|
|
||||||
|
|
||||||
// This trick can be removed/improved if something similar to
|
|
||||||
// boost::current_exception_diagnostic_information got standardized,
|
|
||||||
|
|
||||||
std::exception_ptr curException = std::current_exception();
|
|
||||||
|
|
||||||
try {
|
|
||||||
if ( curException != nullptr ) {
|
|
||||||
std::rethrow_exception( curException );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
qDebug() << "GoldenDict has crashed unexpectedly.\n\n";
|
qDebug() << "GoldenDict has crashed unexpectedly.\n\n";
|
||||||
}
|
|
||||||
}
|
|
||||||
catch ( const std::exception & e ) {
|
|
||||||
qDebug() << "GoldenDict has crashed with exception: " << e.what() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( logFilePtr && logFilePtr->isOpen() )
|
if( logFilePtr && logFilePtr->isOpen() )
|
||||||
logFilePtr->close();
|
logFilePtr->close();
|
||||||
|
|
Loading…
Reference in a new issue