mirror of https://github.com/KLayout/klayout.git
ut_runner does not display dialog on crash but dumps the stack trace to stdout.
This commit is contained in:
parent
34b534e8b4
commit
5fbbccd9e2
|
|
@ -24,6 +24,7 @@
|
|||
#include "layApplication.h"
|
||||
#include "layFileDialog.h"
|
||||
#include "layVersion.h"
|
||||
#include "laySignalHandler.h"
|
||||
#include "tlExceptions.h"
|
||||
#include "tlInternational.h"
|
||||
#include "tlException.h"
|
||||
|
|
@ -232,6 +233,7 @@ klayout_main_cont (int &argc, char **argv)
|
|||
app.reset (new lay::NonGuiApplication (argc, argv));
|
||||
} else {
|
||||
app.reset (new lay::GuiApplication (argc, argv));
|
||||
lay::enable_signal_handler_gui (true);
|
||||
}
|
||||
|
||||
app->parse_cmd (argc, argv);
|
||||
|
|
|
|||
|
|
@ -275,6 +275,13 @@ QString get_symbol_name_from_address (const QString &, size_t)
|
|||
return QString::fromUtf8 ("n/a");
|
||||
}
|
||||
|
||||
static bool s_sh_has_gui = false;
|
||||
|
||||
void enable_signal_handler_gui (bool en)
|
||||
{
|
||||
s_sh_has_gui = en;
|
||||
}
|
||||
|
||||
void signal_handler (int signo, siginfo_t *si, void *)
|
||||
{
|
||||
void *array [100];
|
||||
|
|
@ -292,7 +299,7 @@ void signal_handler (int signo, siginfo_t *si, void *)
|
|||
|
||||
std::auto_ptr<CrashMessage> msg;
|
||||
|
||||
bool has_gui = lay::ApplicationBase::instance () && lay::ApplicationBase::instance ()->has_gui ();
|
||||
bool has_gui = s_sh_has_gui && lay::ApplicationBase::instance () && lay::ApplicationBase::instance ()->has_gui ();
|
||||
|
||||
if (has_gui) {
|
||||
msg.reset (new CrashMessage (0, false, tl::to_qstring (text) + QObject::tr ("\nCollecting backtrace ..")));
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#define HDR_laySignalHandler
|
||||
|
||||
#include <QString>
|
||||
#include "layCommon.h"
|
||||
|
||||
namespace lay
|
||||
{
|
||||
|
|
@ -38,6 +39,11 @@ void install_signal_handlers ();
|
|||
*/
|
||||
QString get_symbol_name_from_address (const QString &mod_name, size_t addr);
|
||||
|
||||
/**
|
||||
* @brief Enables GUI support for signal handlers
|
||||
*/
|
||||
void LAY_PUBLIC enable_signal_handler_gui (bool en);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue