Commit f6e08757 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/Makefile.am new files with code split out of main.c.

2008-10-13  Sven Neumann  <sven@gimp.org>

	* app/Makefile.am
	* app/signals.[ch]: new files with code split out of main.c.

	* app/main.c: changed accordingly.


svn path=/trunk/; revision=27270
parent bce95343
2008-10-13 Sven Neumann <sven@gimp.org>
* app/Makefile.am
* app/signals.[ch]: new files with code split out of main.c.
* app/main.c: changed accordingly.
2008-10-13 Martin Nordholts <martinn@svn.gnome.org>
* app/gegl/gimpoperationadditionmode.c
......
......@@ -49,6 +49,8 @@ app_sources = \
main.c \
sanity.c \
sanity.h \
signals.c \
signals.h \
unique.c \
unique.h \
units.c \
......
......@@ -18,12 +18,9 @@
#include "config.h"
#define _GNU_SOURCE /* for the sigaction stuff */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
......@@ -57,8 +54,8 @@
#include "about.h"
#include "app.h"
#include "errors.h"
#include "sanity.h"
#include "signals.h"
#include "unique.h"
#include "units.h"
#include "version.h"
......@@ -94,7 +91,6 @@ static void gimp_show_license_and_exit (void) G_GNUC_NORETURN;
static void gimp_init_i18n (void);
static void gimp_init_malloc (void);
static void gimp_init_signal_handlers (void);
#ifndef G_OS_WIN32
static void gimp_sigfatal_handler (gint sig_num) G_GNUC_NORETURN;
......@@ -401,7 +397,7 @@ main (int argc,
if (abort_message)
app_abort (no_interface, abort_message);
gimp_init_signal_handlers ();
gimp_init_signal_handlers (stack_trace_mode);
app_run (argv[0],
filenames,
......@@ -638,69 +634,3 @@ gimp_init_i18n (void)
textdomain (GETTEXT_PACKAGE);
}
static void
gimp_init_signal_handlers (void)
{
#ifndef G_OS_WIN32
/* No use catching these on Win32, the user won't get any
* stack trace from glib anyhow. It's better to let Windows inform
* about the program error, and offer debugging (if the user
* has installed MSVC or some other compiler that knows how to
* install itself as a handler for program errors).
*/
/* Handle fatal signals */
/* these are handled by gimp_terminate() */
gimp_signal_private (SIGHUP, gimp_sigfatal_handler, 0);
gimp_signal_private (SIGINT, gimp_sigfatal_handler, 0);
gimp_signal_private (SIGQUIT, gimp_sigfatal_handler, 0);
gimp_signal_private (SIGABRT, gimp_sigfatal_handler, 0);
gimp_signal_private (SIGTERM, gimp_sigfatal_handler, 0);
if (stack_trace_mode != GIMP_STACK_TRACE_NEVER)
{
/* these are handled by gimp_fatal_error() */
gimp_signal_private (SIGBUS, gimp_sigfatal_handler, 0);
gimp_signal_private (SIGSEGV, gimp_sigfatal_handler, 0);
gimp_signal_private (SIGFPE, gimp_sigfatal_handler, 0);
}
/* Ignore SIGPIPE because plug_in.c handles broken pipes */
gimp_signal_private (SIGPIPE, SIG_IGN, 0);
/* Restart syscalls on SIGCHLD */
gimp_signal_private (SIGCHLD, SIG_DFL, SA_RESTART);
#endif /* G_OS_WIN32 */
}
#ifndef G_OS_WIN32
/* gimp core signal handler for fatal signals */
static void
gimp_sigfatal_handler (gint sig_num)
{
switch (sig_num)
{
case SIGHUP:
case SIGINT:
case SIGQUIT:
case SIGABRT:
case SIGTERM:
gimp_terminate (g_strsignal (sig_num));
break;
case SIGBUS:
case SIGSEGV:
case SIGFPE:
default:
gimp_fatal_error (g_strsignal (sig_num));
break;
}
}
#endif /* ! G_OS_WIN32 */
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <signal.h>
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "core/core-types.h"
#include "errors.h"
#include "signals.h"
#ifndef G_OS_WIN32
static void gimp_sigfatal_handler (gint sig_num) G_GNUC_NORETURN;
#endif
void
gimp_init_signal_handlers (GimpStackTraceMode stack_trace_mode)
{
#ifndef G_OS_WIN32
/* No use catching these on Win32, the user won't get any
* stack trace from glib anyhow. It's better to let Windows inform
* about the program error, and offer debugging (if the user
* has installed MSVC or some other compiler that knows how to
* install itself as a handler for program errors).
*/
/* Handle fatal signals */
/* these are handled by gimp_terminate() */
gimp_signal_private (SIGHUP, gimp_sigfatal_handler, 0);
gimp_signal_private (SIGINT, gimp_sigfatal_handler, 0);
gimp_signal_private (SIGQUIT, gimp_sigfatal_handler, 0);
gimp_signal_private (SIGABRT, gimp_sigfatal_handler, 0);
gimp_signal_private (SIGTERM, gimp_sigfatal_handler, 0);
if (stack_trace_mode != GIMP_STACK_TRACE_NEVER)
{
/* these are handled by gimp_fatal_error() */
gimp_signal_private (SIGBUS, gimp_sigfatal_handler, 0);
gimp_signal_private (SIGSEGV, gimp_sigfatal_handler, 0);
gimp_signal_private (SIGFPE, gimp_sigfatal_handler, 0);
}
/* Ignore SIGPIPE because plug_in.c handles broken pipes */
gimp_signal_private (SIGPIPE, SIG_IGN, 0);
/* Restart syscalls on SIGCHLD */
gimp_signal_private (SIGCHLD, SIG_DFL, SA_RESTART);
#endif /* G_OS_WIN32 */
}
#ifndef G_OS_WIN32
/* gimp core signal handler for fatal signals */
static void
gimp_sigfatal_handler (gint sig_num)
{
switch (sig_num)
{
case SIGHUP:
case SIGINT:
case SIGQUIT:
case SIGABRT:
case SIGTERM:
gimp_terminate (g_strsignal (sig_num));
break;
case SIGBUS:
case SIGSEGV:
case SIGFPE:
default:
gimp_fatal_error (g_strsignal (sig_num));
break;
}
}
#endif /* ! G_OS_WIN32 */
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __SIGNALS_H__
#define __SIGNALS_H__
#ifndef GIMP_APP_GLUE_COMPILATION
#signal You must not #include "signals.h" from an app/ subdir
#endif
void gimp_init_signal_handlers (GimpStackTraceMode stack_trace_mode);
#endif /* __SIGNALS_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment