comparison src/gtkmain.c @ 13214:812e2de69c90

[gaim-migrate @ 15578] Patch from Bj??rn Voigt: * early character set conversation for the segfault message * new formating of the English segfault message (URLs are now alone on a line with out a trailing dot - this makes copying of the URLs easier) committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Fri, 10 Feb 2006 21:16:18 +0000
parents 0e7f19583825
children c97c76d9d347
comparison
equal deleted inserted replaced
13213:371f353f7d99 13214:812e2de69c90
170 case SIGHUP: 170 case SIGHUP:
171 gaim_debug_warning("sighandler", "Caught signal %d\n", sig); 171 gaim_debug_warning("sighandler", "Caught signal %d\n", sig);
172 gaim_connections_disconnect_all(); 172 gaim_connections_disconnect_all();
173 break; 173 break;
174 case SIGSEGV: 174 case SIGSEGV:
175 gaim_print_utf8_to_console(stderr, segfault_message); 175 fprintf(stderr, "%s", segfault_message);
176 abort(); 176 abort();
177 break; 177 break;
178 case SIGCHLD: 178 case SIGCHLD:
179 clean_pid(); 179 clean_pid();
180 signal(SIGCHLD, sighandler); /* restore signal catching on this one! */ 180 signal(SIGCHLD, sighandler); /* restore signal catching on this one! */
445 int opt; 445 int opt;
446 gboolean gui_check; 446 gboolean gui_check;
447 gboolean debug_enabled; 447 gboolean debug_enabled;
448 #if HAVE_SIGNAL_H 448 #if HAVE_SIGNAL_H
449 char errmsg[BUFSIZ]; 449 char errmsg[BUFSIZ];
450 #ifndef DEBUG
451 char *segfault_message_tmp;
452 GError *error = NULL;
453 #endif
450 #endif 454 #endif
451 455
452 struct option long_options[] = { 456 struct option long_options[] = {
453 {"config", required_argument, NULL, 'c'}, 457 {"config", required_argument, NULL, 'c'},
454 {"debug", no_argument, NULL, 'd'}, 458 {"debug", no_argument, NULL, 'd'},
487 491
488 #if HAVE_SIGNAL_H 492 #if HAVE_SIGNAL_H
489 493
490 #ifndef DEBUG 494 #ifndef DEBUG
491 /* We translate this here in case the crash breaks gettext. */ 495 /* We translate this here in case the crash breaks gettext. */
492 segfault_message = g_strdup_printf(_( 496 segfault_message_tmp = g_strdup_printf(_(
493 "Gaim has segfaulted and attempted to dump a core file.\n" 497 "Gaim has segfaulted and attempted to dump a core file.\n"
494 "This is a bug in the software and has happened through\n" 498 "This is a bug in the software and has happened through\n"
495 "no fault of your own.\n\n" 499 "no fault of your own.\n\n"
496 "If you can reproduce the crash, please notify the gaim\n" 500 "If you can reproduce the crash, please notify the gaim\n"
497 "developers by reporting a bug at\n" 501 "developers by reporting a bug at\n"
498 "%sbug.php\n\n" 502 "%sbug.php\n\n"
499 "Please make sure to specify what you were doing at the time\n" 503 "Please make sure to specify what you were doing at the time\n"
500 "and post the backtrace from the core file. If you do not know\n" 504 "and post the backtrace from the core file. If you do not know\n"
501 "how to get the backtrace, please read the instructions at\n" 505 "how to get the backtrace, please read the instructions at\n"
502 "%sgdb.php. If you need further\n" 506 "%sgdb.php\n\n"
503 "assistance, please IM either SeanEgn or LSchiere (via AIM).\n" 507 "If you need further assistance, please IM either SeanEgn or \n"
504 "Contact information for Sean and Luke on other protocols is at\n" 508 "LSchiere (via AIM). Contact information for Sean and Luke \n"
505 "%scontactinfo.php.\n"), 509 "on other protocols is at\n"
510 "%scontactinfo.php\n"),
506 GAIM_WEBSITE, GAIM_WEBSITE, GAIM_WEBSITE 511 GAIM_WEBSITE, GAIM_WEBSITE, GAIM_WEBSITE
507 ); 512 );
513
514 /* we have to convert the message (UTF-8 to console
515 charset) early because after a segmentation fault
516 it's not a good practice to allocate memory */
517 segfault_message = g_locale_from_utf8(segfault_message_tmp,
518 -1, NULL, NULL, &error);
519 if (segfault_message != NULL) {
520 g_free(segfault_message_tmp);
521 }
522 else {
523 /* use 'segfault_message_tmp' (UTF-8) as a fallback */
524 g_warning("%s\n", error->message);
525 g_error_free(error);
526 segfault_message = segfault_message_tmp;
527 }
508 #else 528 #else
509 /* Don't mark this for translation. */ 529 /* Don't mark this for translation. */
510 segfault_message = g_strdup( 530 segfault_message = g_strdup(
511 "Hi, user. We need to talk.\n" 531 "Hi, user. We need to talk.\n"
512 "I think something's gone wrong here. It's probably my fault.\n" 532 "I think something's gone wrong here. It's probably my fault.\n"