commit 26c4fd851b0c0f0021ede063a901ebede7ee4bdf
parent 0f9e5e0dd310d6ee7413775e3c8e853eafee5dfa
Author: Oliver Lowe <o@olowe.co>
Date: Tue, 12 Aug 2025 22:22:40 +1000
Remove crash dialogue
Let it crash like every other program
Diffstat:
7 files changed, 3 insertions(+), 669 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -238,10 +238,6 @@ AC_ARG_ENABLE(enchant,
[ --disable-enchant Do not build Enchant support for spell-checking],
[enable_enchant=$enableval], [enable_enchant=yes])
-AC_ARG_ENABLE(crash-dialog,
- [ --enable-crash-dialog Build crash dialog],
- [enable_crash_dialog=$enableval], [enable_crash_dialog=no])
-
AC_ARG_ENABLE(startup-notification,
[ --disable-startup-notification Do not startup notification support],
[enable_startup_notification=$enableval], [enable_startup_notification=yes])
@@ -465,17 +461,6 @@ if test $enable_enchant = yes; then
AC_SUBST(ENCHANT_LIBS)
fi
-dnl want crash dialog
-if test $enable_crash_dialog = yes; then
-dnl check if GDB is somewhere
- AC_CHECK_PROG(enable_crash_dialog, gdb, yes, no)
- AC_MSG_CHECKING([whether to use crash dialog])
- if test $enable_crash_dialog = yes; then
- AC_DEFINE(CRASH_DIALOG, 1, Pop up crash dialog)
- fi
- AC_MSG_RESULT($enable_crash_dialog)
-fi
-
dnl
dnl Check whether we need to pass -lresolv
dnl We know that we don't need it for W32.
@@ -756,7 +741,6 @@ echo "iconv : $am_cv_func_iconv"
echo "enchant : $enable_enchant"
echo "IMAP4 (libetpan) : $enable_libetpan"
echo "NNTP (libetpan) : $enable_libetpan"
-echo "Crash dialog : $enable_crash_dialog"
echo "Manual : $enable_manual"
echo "SVG support : $enable_svg"
echo "Unit tests : $enable_tests"
diff --git a/src/Makefile.am b/src/Makefile.am
@@ -87,7 +87,6 @@ claws_mail_SOURCES = \
autofaces.c \
avatars.c \
compose.c \
- crash.c \
customheader.c \
displayheader.c \
edittags.c \
@@ -206,7 +205,6 @@ claws_mailinclude_HEADERS = \
autofaces.h \
avatars.h \
compose.h \
- crash.h \
customheader.h \
displayheader.h \
edittags.h \
diff --git a/src/crash.c b/src/crash.c
@@ -1,529 +0,0 @@
-/*
- * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2019 by the Claws Mail Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef CRASH_DIALOG
-
-#include "defs.h"
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <errno.h>
-#include <fcntl.h>
-
-#if defined(__GNU_LIBRARY__) && !defined(__UCLIBC__)
-# include <gnu/libc-version.h>
-#endif
-
-#include "main.h"
-#include "claws.h"
-#include "crash.h"
-#include "file-utils.h"
-#include "filesel.h"
-#include "version.h"
-#include "prefs_common.h"
-#include "manage_window.h"
-
-/*
- * NOTE: the crash dialog is called when claws is not
- * initialized, so do not assume settings are available.
- * for example, loading / creating pixmaps seems not
- * to be possible.
- */
-
-/***/
-
-static GtkWidget *crash_dialog_show (const gchar *text,
- const gchar *debug_output);
-static void crash_create_debugger_file (void);
-static void crash_save_crash_log (GtkButton *, const gchar *);
-static void crash_create_bug_report (GtkButton *, const gchar *);
-static void crash_debug (unsigned long crash_pid,
- gchar *exe_image,
- GString *debug_output);
-static gchar *get_compiled_in_features (void);
-static gchar *get_lib_version (void);
-static gboolean is_crash_dialog_allowed (void);
-static void crash_handler (int sig);
-static void crash_cleanup_exit (void);
-
-/***/
-
-static const gchar *DEBUG_SCRIPT = "thread all apply\nbt full\nkill\nq";
-
-/***/
-
-/*!
- *\brief install crash handlers
- */
-void crash_install_handlers(void)
-{
-#if CRASH_DIALOG
- sigset_t mask;
-
- if (!is_crash_dialog_allowed()) return;
-
- sigemptyset(&mask);
-
-#ifdef SIGSEGV
- signal(SIGSEGV, crash_handler);
- sigaddset(&mask, SIGSEGV);
-#endif
-
-#ifdef SIGFPE
- signal(SIGFPE, crash_handler);
- sigaddset(&mask, SIGFPE);
-#endif
-
-#ifdef SIGILL
- signal(SIGILL, crash_handler);
- sigaddset(&mask, SIGILL);
-#endif
-
-#ifdef SIGABRT
- signal(SIGABRT, crash_handler);
- sigaddset(&mask, SIGABRT);
-#endif
-
- sigprocmask(SIG_UNBLOCK, &mask, 0);
-#endif /* CRASH_DIALOG */
-}
-
-/***/
-
-/*!
- *\brief crash dialog entry point
- */
-void crash_main(const char *arg)
-{
-#if CRASH_DIALOG
- gchar *text;
- gchar **tokens;
- unsigned long pid;
- GString *output;
-
- crash_create_debugger_file();
- tokens = g_strsplit(arg, ",", 0);
-
- pid = atol(tokens[0]);
- text = g_strdup_printf(_("Claws Mail process (%ld) received signal %ld"),
- pid, atol(tokens[1]));
-
- output = g_string_new("");
- crash_debug(pid, tokens[2], output);
-
- /*
- * try to get the settings
- */
- prefs_common_read_config();
-
- crash_dialog_show(text, output->str);
- g_string_free(output, TRUE);
- g_free(text);
- g_strfreev(tokens);
-#endif /* CRASH_DIALOG */
-}
-
-/*!
- *\brief show crash dialog
- *
- *\param text Description
- *\param debug_output Output text by gdb
- *
- *\return GtkWidget * Dialog widget
- */
-static GtkWidget *crash_dialog_show(const gchar *text, const gchar *debug_output)
-{
- GtkWidget *window1;
- GtkWidget *vbox1;
- GtkWidget *hbox1;
- GtkWidget *label1;
- GtkWidget *frame1;
- GtkWidget *scrolledwindow1;
- GtkWidget *text1;
- GtkWidget *hbuttonbox3;
- GtkWidget *hbuttonbox4;
- GtkWidget *button3;
- GtkWidget *button4;
- GtkWidget *button5;
- gchar *crash_report;
- GtkTextBuffer *buffer;
- GtkTextIter iter;
- gchar *features = get_compiled_in_features();
- gchar *os = get_operating_system();
- gchar *lversion = get_lib_version();
-
- window1 = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "crash");
- gtk_container_set_border_width(GTK_CONTAINER(window1), 5);
- gtk_window_set_title(GTK_WINDOW(window1), _("Claws Mail has crashed"));
- gtk_window_set_position(GTK_WINDOW(window1), GTK_WIN_POS_CENTER);
- gtk_window_set_type_hint(GTK_WINDOW(window1), GDK_WINDOW_TYPE_HINT_DIALOG);
- gtk_window_set_modal(GTK_WINDOW(window1), TRUE);
- gtk_window_set_default_size(GTK_WINDOW(window1), 460, 272);
-
-
- vbox1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
- gtk_widget_show(vbox1);
- gtk_container_add(GTK_CONTAINER(window1), vbox1);
-
- hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
- gtk_widget_show(hbox1);
- gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, TRUE, 0);
- gtk_container_set_border_width(GTK_CONTAINER(hbox1), 4);
-
- label1 = gtk_label_new
- (g_strdup_printf(_("%s.\nPlease file a bug report and include the information below."), text));
- gtk_widget_show(label1);
- gtk_box_pack_start(GTK_BOX(hbox1), label1, TRUE, TRUE, 0);
- gtk_label_set_xalign(GTK_LABEL(label1), 0.0);
-
- frame1 = gtk_frame_new(_("Debug log"));
- gtk_widget_show(frame1);
- gtk_box_pack_start(GTK_BOX(vbox1), frame1, TRUE, TRUE, 0);
-
- scrolledwindow1 = gtk_scrolled_window_new(NULL, NULL);
- gtk_widget_show(scrolledwindow1);
- gtk_container_add(GTK_CONTAINER(frame1), scrolledwindow1);
- gtk_container_set_border_width(GTK_CONTAINER(scrolledwindow1), 3);
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow1),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-
- text1 = gtk_text_view_new();
- gtk_text_view_set_editable(GTK_TEXT_VIEW(text1), FALSE);
- gtk_widget_show(text1);
- gtk_container_add(GTK_CONTAINER(scrolledwindow1), text1);
-
- crash_report = g_strdup_printf(
- "Claws Mail version %s\n"
- "GTK version %d.%d.%d / GLib %d.%d.%d\n"
- "Locale: %s (charset: %s)\n"
- "Features:%s\n"
- "C Library: %s\n--\n%s",
- VERSION,
- gtk_major_version, gtk_minor_version, gtk_micro_version,
- glib_major_version, glib_minor_version, glib_micro_version,
- conv_get_current_locale(), conv_get_locale_charset_str(),
- features, lversion, debug_output);
- g_free(features);
- g_free(os);
- g_free(lversion);
-
- buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text1));
- gtk_text_buffer_get_start_iter(buffer, &iter);
- gtk_text_buffer_insert(buffer, &iter, crash_report, -1);
-
- hbuttonbox3 = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
- gtk_widget_show(hbuttonbox3);
- gtk_box_pack_start(GTK_BOX(vbox1), hbuttonbox3, FALSE, FALSE, 0);
-
- hbuttonbox4 = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
- gtk_widget_show(hbuttonbox4);
- gtk_box_pack_start(GTK_BOX(vbox1), hbuttonbox4, FALSE, FALSE, 0);
-
- button3 = gtk_button_new_with_label(_("Close"));
- gtk_widget_show(button3);
- gtk_container_add(GTK_CONTAINER(hbuttonbox4), button3);
- gtk_widget_set_can_default(button3, TRUE);
-
- button4 = gtk_button_new_with_label(_("Save..."));
- gtk_widget_show(button4);
- gtk_container_add(GTK_CONTAINER(hbuttonbox4), button4);
- gtk_widget_set_can_default(button4, TRUE);
-
- button5 = gtk_button_new_with_label(_("Create bug report"));
- gtk_widget_show(button5);
- gtk_container_add(GTK_CONTAINER(hbuttonbox4), button5);
- gtk_widget_set_can_default(button5, TRUE);
-
- g_signal_connect(G_OBJECT(window1), "delete_event",
- G_CALLBACK(gtk_main_quit), NULL);
- g_signal_connect(G_OBJECT(button3), "clicked",
- G_CALLBACK(gtk_main_quit), NULL);
- g_signal_connect(G_OBJECT(button4), "clicked",
- G_CALLBACK(crash_save_crash_log), crash_report);
- g_signal_connect(G_OBJECT(button5), "clicked",
- G_CALLBACK(crash_create_bug_report), NULL);
-
- MANAGE_WINDOW_SIGNALS_CONNECT(window1);
-
- gtk_widget_show(window1);
-
- gtk_main();
- return window1;
-}
-
-
-/*!
- *\brief create debugger script file in claws directory.
- * all the other options (creating temp files) looked too
- * convoluted.
- */
-static void crash_create_debugger_file(void)
-{
- gchar *filespec = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, DEBUGGERRC, NULL);
-
- str_write_to_file(DEBUG_SCRIPT, filespec, TRUE);
- g_free(filespec);
-}
-
-/*!
- *\brief saves crash log to a file
- */
-static void crash_save_crash_log(GtkButton *button, const gchar *text)
-{
- time_t timer;
- struct tm *lt;
- char buf[100];
- struct tm buft;
- gchar *filename;
-
- timer = time(NULL);
- lt = localtime_r(&timer, &buft);
- strftime(buf, sizeof buf, "claws-crash-log-%Y-%m-%d-%H-%M-%S.txt", lt);
- if (NULL != (filename = filesel_select_file_save(_("Save crash information"), buf))
- && *filename)
- str_write_to_file(text, filename, TRUE);
- g_free(filename);
-}
-
-/*!
- *\brief create bug report (goes to Claws Mail bug tracker)
- */
-static void crash_create_bug_report(GtkButton *button, const gchar *data)
-{
- open_uri(BUGZILLA_URI, prefs_common_get_uri_cmd());
-}
-
-/*!
- *\brief launches debugger and attaches it to crashed claws
- */
-static void crash_debug(unsigned long crash_pid,
- gchar *exe_image,
- GString *debug_output)
-{
- int choutput[2];
- pid_t pid;
-
- if (pipe(choutput) == -1) {
- g_print("can't pipe - error %s", g_strerror(errno));
- return;
- }
-
- if (0 == (pid = fork())) {
- char *argp[10];
- char **argptr = argp;
- gchar *filespec = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, DEBUGGERRC, NULL);
-
- if (setgid(getgid()) != 0)
- perror("setgid");
- if (setuid(getuid()) != 0)
- perror("setuid");
-
- /*
- * setup debugger to attach to crashed claws
- */
- *argptr++ = "gdb";
- *argptr++ = "--nw";
- *argptr++ = "--nx";
- *argptr++ = "--quiet";
- *argptr++ = "--batch";
- *argptr++ = "-x";
- *argptr++ = filespec;
- *argptr++ = exe_image;
- *argptr++ = g_strdup_printf("%ld", crash_pid);
- *argptr = NULL;
-
- /*
- * redirect output to write end of pipe
- */
- close(1);
- if (dup(choutput[1]) < 0)
- perror("dup");
- close(choutput[0]);
- if (-1 == execvp("gdb", argp))
- perror("execvp");
- } else {
- char buf[100];
- int r;
-
- waitpid(pid, NULL, 0);
-
- /*
- * make it non blocking
- */
- if (-1 == fcntl(choutput[0], F_SETFL, O_NONBLOCK))
- g_print("set to non blocking failed\n");
-
- /*
- * get the output
- */
- do {
- r = read(choutput[0], buf, sizeof buf - 1);
- if (r > 0) {
- buf[r] = 0;
- g_string_append(debug_output, buf);
- }
- } while (r > 0);
-
- close(choutput[0]);
- close(choutput[1]);
-
- /*
- * kill the process we attached to
- */
- kill(crash_pid, SIGCONT);
- }
-}
-
-/***/
-
-/*!
- *\brief features
- */
-static gchar *get_compiled_in_features(void)
-{
- return g_strdup_printf("%s",
-#if HAVE_ICONV
- " iconv"
-#endif
-#if USE_GNUTLS
- " GnuTLS"
-#endif
-#if USE_ENCHANT
- " GNU/aspell"
-#endif
-#if HAVE_LIBETPAN
- " libetpan"
-#endif
- "");
-}
-
-/*!
- *\brief library version
- */
-static gchar *get_lib_version(void)
-{
-#if defined(__UCLIBC__)
- return g_strdup_printf("uClibc %i.%i.%i", __UCLIBC_MAJOR__, __UCLIBC_MINOR__, __UCLIBC_SUBLEVEL__);
-#elif defined(__GNU_LIBRARY__)
- return g_strdup_printf("GNU libc %s", gnu_get_libc_version());
-#else
- return g_strdup(_("Unknown"));
-#endif
-}
-
-/*!
- *\brief see if the crash dialog is allowed (because some
- * developers may prefer to run Claws Mail under gdb...)
- */
-static gboolean is_crash_dialog_allowed(void)
-{
- return !g_getenv("CLAWS_NO_CRASH");
-}
-
-/*!
- *\brief this handler will probably evolve into
- * something better.
- */
-static void crash_handler(int sig)
-{
- pid_t pid;
- static volatile unsigned long crashed_ = 0;
-
- /*
- * let's hope argv0 aren't trashed.
- * both are defined in main.c.
- */
- extern gchar *argv0;
-
-
- /*
- * besides guarding entrancy it's probably also better
- * to mask off signals
- */
- if (crashed_) return;
-
- crashed_++;
-
-#ifdef SIGTERM
- if (sig == SIGTERM)
- clean_quit(NULL);
-#endif
-
- /*
- * gnome ungrabs focus, and flushes gdk. mmmh, good idea.
- */
- gdk_pointer_ungrab(GDK_CURRENT_TIME);
- gdk_keyboard_ungrab(GDK_CURRENT_TIME);
- gdk_flush();
-
- if (0 == (pid = fork())) {
- char buf[50];
- char *args[5];
-
- /*
- * probably also some other parameters (like GTK ones).
- * also we pass the full startup dir and the real command
- * line typed in (argv0)
- */
- args[0] = argv0;
- args[1] = "--debug";
- args[2] = "--crash";
- sprintf(buf, "%d,%d,%s", getppid(), sig, argv0);
- args[3] = buf;
- args[4] = NULL;
-
- if (chdir(claws_get_startup_dir()) != 0)
- FILE_OP_ERROR(claws_get_startup_dir(), "chdir");
- if (setgid(getgid()) != 0)
- perror("setgid");
- if (setuid(getuid()) != 0 )
- perror("setuid");
- execvp(argv0, args);
- perror("execvp");
- } else {
- waitpid(pid, NULL, 0);
- crash_cleanup_exit();
- _exit(253);
- }
-
- _exit(253);
-}
-
-/*!
- *\brief put all the things here we can do before
- * letting the program die
- */
-static void crash_cleanup_exit(void)
-{
- const char *filename = claws_get_socket_name();
- claws_unlink(filename);
-}
-
-#endif
diff --git a/src/crash.h b/src/crash.h
@@ -1,29 +0,0 @@
-/*
- * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2012 by the Claws Mail Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef CRASH_H__
-#define CRASH_H__
-
-#define DEBUGGERRC "debuggerrc"
-
-void crash_install_handlers (void);
-void crash_main (const char *arg);
-
-#endif /* CRASH_H__ */
-
diff --git a/src/folder.c b/src/folder.c
@@ -649,10 +649,7 @@ void folder_item_set_xml(Folder *folder, FolderItem *item, XMLTag *tag)
} else if (!strcmp(attr->name, "apply_sub")) {
item->apply_sub = *attr->value == '1' ? TRUE : FALSE;
} else if (!strcmp(attr->name, "last_seen")) {
- if (!claws_crashed())
- item->last_seen = atoi(attr->value);
- else
- item->last_seen = 0;
+ item->last_seen = atoi(attr->value);
}
}
/* options without meaning in drafts */
diff --git a/src/main.c b/src/main.c
@@ -137,17 +137,12 @@
#include "version.h"
-#include "crash.h"
-
#include "timing.h"
#ifdef G_OS_WIN32
#include <windows.h>
#endif
gchar *prog_version;
-#ifdef CRASH_DIALOG
-gchar *argv0;
-#endif
#ifdef HAVE_STARTUP_NOTIFICATION
static SnLauncheeContext *sn_context = NULL;
@@ -182,9 +177,7 @@ static struct RemoteCmd {
GPtrArray *status_folders;
GPtrArray *status_full_folders;
gboolean send;
- gboolean crash;
int online_mode;
- gchar *crash_params;
gboolean exit;
gboolean subscribe;
const gchar *subscribe_uri;
@@ -198,7 +191,6 @@ static void parse_cmd_opt(int argc, char *argv[]);
static gint prohibit_duplicate_launch (int *argc,
char ***argv);
-static gchar * get_crashfile_name (void);
static gint lock_socket_remove (void);
static void lock_socket_input_cb (gpointer data,
gint source,
@@ -425,11 +417,6 @@ backup_mode:
static gboolean sc_exiting = FALSE;
static gboolean show_at_startup = TRUE;
-static gboolean claws_crashed_bool = FALSE;
-
-gboolean claws_crashed(void) {
- return claws_crashed_bool;
-}
void main_set_show_at_startup(gboolean show)
{
@@ -645,7 +632,6 @@ int main(int argc, char *argv[])
MainWindow *mainwin;
FolderView *folderview;
GdkPixbuf *icon;
- gboolean crash_file_present = FALSE;
guint num_folder_class = 0;
gboolean asked_for_migration = FALSE;
gboolean start_done = TRUE;
@@ -668,9 +654,6 @@ int main(int argc, char *argv[])
}
prog_version = PROG_VERSION;
-#ifdef CRASH_DIALOG
- argv0 = g_strdup(argv[0]);
-#endif
parse_cmd_opt(argc, argv);
@@ -692,18 +675,6 @@ int main(int argc, char *argv[])
main_dump_features_list(TRUE);
prefs_prepare_cache();
-
-#ifdef CRASH_DIALOG
- if (cmd.crash) {
- gtk_init(&argc, &argv);
- crash_main(cmd.crash_params);
-#ifdef G_OS_WIN32
- win32_close_log();
-#endif
- return 0;
- }
- crash_install_handlers();
-#endif
install_basic_sighandlers();
if (cmd.status || cmd.status_full || cmd.search ||
@@ -802,14 +773,9 @@ int main(int argc, char *argv[])
MAKE_DIR_IF_NOT_EXIST(get_tmp_dir());
MAKE_DIR_IF_NOT_EXIST(UIDL_DIR);
- crash_file_present = is_file_exist(get_crashfile_name());
- /* remove temporary files */
remove_all_files(get_tmp_dir());
remove_all_files(get_mime_tmp_dir());
- if (!cmd.crash && crash_file_present)
- claws_crashed_bool = TRUE;
-
if (is_file_exist("claws.log")) {
if (rename_force("claws.log", "claws.log.bak") < 0)
FILE_OP_ERROR("claws.log", "rename");
@@ -985,13 +951,6 @@ int main(int argc, char *argv[])
toolbar_main_set_sensitive(mainwin);
main_window_set_menu_sensitive(mainwin);
- /* if crashed, show window early so that the user
- * sees what's happening */
- if (claws_crashed()) {
- main_window_popup(mainwin);
- mainwin_shown = TRUE;
- }
-
account_set_missing_folder();
folder_set_missing_folders();
folderview_set(folderview);
@@ -1003,26 +962,7 @@ int main(int argc, char *argv[])
main_window_cursor_wait(mainwin);
folder_func_to_all_folders(initial_processing, (gpointer *)mainwin);
- /* if claws crashed, rebuild caches */
- if (claws_crashed()) {
- GTK_EVENTS_FLUSH();
- debug_print("Claws Mail crashed, checking for new messages in local folders\n");
- folder_item_update_thaw();
- folderview_check_new(NULL);
- folder_clean_cache_memory_force();
- folder_item_update_freeze();
- }
- /* make the crash-indicator file */
- if (str_write_to_file("foo", get_crashfile_name(), FALSE) < 0) {
- g_warning("can't create the crash-indicator file");
- }
-
inc_autocheck_timer_init(mainwin);
-
- /* ignore SIGPIPE signal for preventing sudden death of program */
-#ifdef G_OS_UNIX
- signal(SIGPIPE, SIG_IGN);
-#endif
if (cmd.online_mode == ONLINE_MODE_OFFLINE) {
main_window_toggle_work_offline(mainwin, TRUE, FALSE);
}
@@ -1055,7 +995,6 @@ int main(int argc, char *argv[])
prefs_common_write_config();
}
- /* if not crashed, show window now */
if (!mainwin_shown) {
/* apart if something told not to show */
if (show_at_startup)
@@ -1109,12 +1048,10 @@ int main(int argc, char *argv[])
}
if (!cmd.target && prefs_common.goto_folder_on_startup &&
- folder_find_item_from_identifier(prefs_common.startup_folder) != NULL &&
- !claws_crashed()) {
+ folder_find_item_from_identifier(prefs_common.startup_folder) != NULL) {
cmd.target = prefs_common.startup_folder;
} else if (!cmd.target && prefs_common.goto_last_folder_on_startup &&
- folder_find_item_from_identifier(prefs_common.last_opened_folder) != NULL &&
- !claws_crashed()) {
+ folder_find_item_from_identifier(prefs_common.last_opened_folder) != NULL) {
cmd.target = prefs_common.last_opened_folder;
}
@@ -1235,9 +1172,6 @@ static void exit_claws(MainWindow *mainwin)
imap_main_done(TRUE);
nntp_main_done(TRUE);
#endif
- /* delete crashfile */
- if (!cmd.crash)
- claws_unlink(get_crashfile_name());
lock_socket_remove();
@@ -1575,10 +1509,6 @@ static void parse_cmd_opt(int argc, char *argv[])
g_free(base);
exit(1);
- } else if (!strcmp(argv[i], "--crash")) {
- cmd.crash = TRUE;
- cmd.crash_params = g_strdup((i+1 < argc)?argv[i+1]:NULL);
- i++;
} else if (!strcmp(argv[i], "--config-dir")) {
g_print(RC_DIR "\n");
exit(0);
@@ -1784,10 +1714,6 @@ gboolean claws_is_starting(void)
}
#ifdef G_OS_UNIX
-/*
- * CLAWS: want this public so crash dialog can delete the
- * lock file too
- */
gchar *claws_get_socket_name(void)
{
static gchar *filename = NULL;
@@ -1829,18 +1755,6 @@ gchar *claws_get_socket_name(void)
}
#endif
-static gchar *get_crashfile_name(void)
-{
- static gchar *filename = NULL;
-
- if (filename == NULL) {
- filename = g_strdup_printf("%s%cclaws-crashed",
- get_tmp_dir(), G_DIR_SEPARATOR);
- }
-
- return filename;
-}
-
static gint prohibit_duplicate_launch(int *argc, char ***argv)
{
gint sock;
diff --git a/src/main.h b/src/main.h
@@ -33,6 +33,5 @@ gboolean claws_is_exiting(void);
gboolean claws_is_starting(void);
gchar *claws_get_socket_name(void);
void main_set_show_at_startup(gboolean show);
-gboolean claws_crashed(void);
#endif /* __MAIN_H__ */