mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
try to make a gui message when lyx crashes, don't crash again on windows (use exit()).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34056 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a7734edf8e
commit
c98745c081
33
src/LyX.cpp
33
src/LyX.cpp
@ -611,21 +611,23 @@ static void error_handler(int err_sig)
|
|||||||
|
|
||||||
// This shouldn't matter here, however, as we've already invoked
|
// This shouldn't matter here, however, as we've already invoked
|
||||||
// emergencyCleanup.
|
// emergencyCleanup.
|
||||||
|
docstring msg;
|
||||||
switch (err_sig) {
|
switch (err_sig) {
|
||||||
#ifdef SIGHUP
|
#ifdef SIGHUP
|
||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
lyxerr << "\nlyx: SIGHUP signal caught\nBye." << endl;
|
msg = _("SIGHUP signal caught!\nBye.");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
lyxerr << "\nlyx: SIGFPE signal caught\nBye." << endl;
|
msg = _("SIGFPE signal caught!\nBye.");
|
||||||
break;
|
break;
|
||||||
case SIGSEGV:
|
case SIGSEGV:
|
||||||
lyxerr << "\nlyx: SIGSEGV signal caught\n"
|
msg = _("SIGSEGV signal caught!\n"
|
||||||
"Sorry, you have found a bug in LyX. "
|
"Sorry, you have found a bug in LyX, "
|
||||||
|
"hope you have not lost any data.\n"
|
||||||
"Please read the bug-reporting instructions "
|
"Please read the bug-reporting instructions "
|
||||||
"in Help->Introduction and send us a bug report, "
|
"in 'Help->Introduction' and send us a bug report, "
|
||||||
"if necessary. Thanks !\nBye." << endl;
|
"if necessary. Thanks !\nBye.");
|
||||||
break;
|
break;
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
@ -633,6 +635,12 @@ static void error_handler(int err_sig)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!msg.empty()) {
|
||||||
|
lyxerr << "\nlyx: " << msg << endl;
|
||||||
|
// try to make a GUI message
|
||||||
|
Alert::error(_("LyX crashed!"), msg);
|
||||||
|
}
|
||||||
|
|
||||||
// Deinstall the signal handlers
|
// Deinstall the signal handlers
|
||||||
#ifdef SIGHUP
|
#ifdef SIGHUP
|
||||||
signal(SIGHUP, SIG_DFL);
|
signal(SIGHUP, SIG_DFL);
|
||||||
@ -644,11 +652,18 @@ static void error_handler(int err_sig)
|
|||||||
|
|
||||||
#ifdef SIGHUP
|
#ifdef SIGHUP
|
||||||
if (err_sig == SIGSEGV ||
|
if (err_sig == SIGSEGV ||
|
||||||
(err_sig != SIGHUP && !getEnv("LYXDEBUG").empty()))
|
(err_sig != SIGHUP && !getEnv("LYXDEBUG").empty())) {
|
||||||
|
#else
|
||||||
|
if (err_sig == SIGSEGV || !getEnv("LYXDEBUG").empty()) {
|
||||||
|
#endif
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// with abort() it crashes again.
|
||||||
|
exit(err_sig);
|
||||||
#else
|
#else
|
||||||
if (err_sig == SIGSEGV || !getEnv("LYXDEBUG").empty())
|
|
||||||
#endif
|
|
||||||
abort();
|
abort();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user