Skip to content

Commit bc5e15e

Browse files
committed
Improve user info after a crash
After a crash, a modal dialog showing the location of the crash log is displayed.
1 parent 9ad5938 commit bc5e15e

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/third-party/backward.h

+20-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
#ifndef H_6B9572DA_A64B_49E6_B234_051480991C89
2727
#define H_6B9572DA_A64B_49E6_B234_051480991C89
2828

29+
/* Addition for geeqie */
30+
#include <intl.h>
31+
/* end */
32+
2933
#ifndef __cplusplus
3034
#error "It's not going to compile without a C++ compiler..."
3135
#endif
@@ -4250,8 +4254,10 @@ class SignalHandling {
42504254
#else
42514255
error_addr = reinterpret_cast<void *>(uctx->uc_mcontext.pc);
42524256
#endif
4257+
/* Addition for geeqie */
42534258
#elif defined(__loongarch64)
42544259
error_addr = reinterpret_cast<void *>(uctx->uc_mcontext.__pc);
4260+
/* end */
42554261
#elif defined(__mips__)
42564262
error_addr = reinterpret_cast<void *>(
42574263
reinterpret_cast<struct sigcontext *>(&uctx->uc_mcontext)->sc_pc);
@@ -4280,12 +4286,24 @@ class SignalHandling {
42804286
printer.address = true;
42814287
printer.print(st, stderr);
42824288

4283-
/** @FIXME This is probably not the correct way to do this */
4289+
/* Addition for geeqie */
4290+
/** @FIXME This is probably not the correct way to do this */
42844291
FILE *fp;
4285-
fp = fopen("/tmp/geeqie-crash.log", "a");
4292+
fp = fopen("/tmp/geeqie-crash.log", "w");
42864293
printer.print(st, fp);
42874294
fclose(fp);
42884295

4296+
GtkWidget *dialog;
4297+
4298+
dialog = gtk_message_dialog_new( nullptr, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Sorry - Geeqie has crashed")
4299+
);
4300+
4301+
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), _("Crash log file: /tmp/geeqie-crash.log")
4302+
);
4303+
gtk_dialog_run(GTK_DIALOG(dialog));
4304+
/* end */
4305+
4306+
42894307
#if (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700) || \
42904308
(defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L)
42914309
psiginfo(info, nullptr);

0 commit comments

Comments
 (0)