app, tools: various fixes for Win32 build.
* Type pid_t is not cross-platform. Just use int instead, and convert it to respective type on each platform. * Get rid of several useless include which should have been removed a few commits ago, when I reimplemented the backtrace function. * Better handle the various macros in gimp_eek() (between G_OS_WIN32, HAVE_EXCHNDL and GIMP_CONSOLE_COMPILATION, but also no_interface and generate_backtrace options, that was a bit messy). * Make gimpdebug now always built, whatever the platform.
This commit is contained in:
38
app/errors.c
38
app/errors.c
@ -19,13 +19,7 @@
|
|||||||
|
|
||||||
#define _GNU_SOURCE /* need the POSIX signal API */
|
#define _GNU_SOURCE /* need the POSIX signal API */
|
||||||
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
@ -262,8 +256,9 @@ gimp_eek (const gchar *reason,
|
|||||||
const gchar *message,
|
const gchar *message,
|
||||||
gboolean use_handler)
|
gboolean use_handler)
|
||||||
{
|
{
|
||||||
GimpCoreConfig *config = the_errors_gimp->config;
|
GimpCoreConfig *config = the_errors_gimp->config;
|
||||||
gboolean generate_backtrace = FALSE;
|
gboolean generate_backtrace = FALSE;
|
||||||
|
gboolean eek_handled = FALSE;
|
||||||
|
|
||||||
/* GIMP has 2 ways to handle termination signals and fatal errors: one
|
/* GIMP has 2 ways to handle termination signals and fatal errors: one
|
||||||
* is the stack trace mode which is set at start as command line
|
* is the stack trace mode which is set at start as command line
|
||||||
@ -277,10 +272,13 @@ gimp_eek (const gchar *reason,
|
|||||||
"generate-backtrace", &generate_backtrace,
|
"generate-backtrace", &generate_backtrace,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
#ifndef G_OS_WIN32
|
/* Let's just always output on stdout at least so that there is a
|
||||||
|
* trace if the rest fails. */
|
||||||
g_printerr ("%s: %s: %s\n", gimp_filename_to_utf8 (full_prog_name),
|
g_printerr ("%s: %s: %s\n", gimp_filename_to_utf8 (full_prog_name),
|
||||||
reason, message);
|
reason, message);
|
||||||
|
|
||||||
|
#if ! defined (G_OS_WIN32) || defined (HAVE_EXCHNDL)
|
||||||
|
|
||||||
if (use_handler)
|
if (use_handler)
|
||||||
{
|
{
|
||||||
#ifndef GIMP_CONSOLE_COMPILATION
|
#ifndef GIMP_CONSOLE_COMPILATION
|
||||||
@ -307,9 +305,12 @@ gimp_eek (const gchar *reason,
|
|||||||
g_spawn_sync (NULL, args, NULL,
|
g_spawn_sync (NULL, args, NULL,
|
||||||
G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL | G_SPAWN_STDOUT_TO_DEV_NULL,
|
G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL | G_SPAWN_STDOUT_TO_DEV_NULL,
|
||||||
NULL, NULL, NULL, NULL, &exit_status, NULL);
|
NULL, NULL, NULL, NULL, &exit_status, NULL);
|
||||||
|
eek_handled = TRUE;
|
||||||
}
|
}
|
||||||
else
|
#endif /* !GIMP_CONSOLE_COMPILATION */
|
||||||
#endif
|
|
||||||
|
#ifndef G_OS_WIN32
|
||||||
|
if (! eek_handled)
|
||||||
{
|
{
|
||||||
switch (stack_trace_mode)
|
switch (stack_trace_mode)
|
||||||
{
|
{
|
||||||
@ -345,15 +346,16 @@ gimp_eek (const gchar *reason,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* g_on_error_* don't do anything reasonable on Win32. */
|
|
||||||
|
|
||||||
MessageBox (NULL, g_strdup_printf ("%s: %s", reason, message),
|
|
||||||
full_prog_name, MB_OK|MB_ICONERROR);
|
|
||||||
|
|
||||||
#endif /* ! G_OS_WIN32 */
|
#endif /* ! G_OS_WIN32 */
|
||||||
|
}
|
||||||
|
#endif /* ! G_OS_WIN32 || HAVE_EXCHNDL */
|
||||||
|
|
||||||
|
#if defined (G_OS_WIN32) && ! defined (GIMP_CONSOLE_COMPILATION)
|
||||||
|
/* g_on_error_* don't do anything reasonable on Win32. */
|
||||||
|
if (! eek_handled && ! the_errors_gimp->no_interface)
|
||||||
|
MessageBox (NULL, g_strdup_printf ("%s: %s", reason, message),
|
||||||
|
full_prog_name, MB_OK|MB_ICONERROR);
|
||||||
|
#endif
|
||||||
|
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -217,8 +217,10 @@ gimp_critical_dialog_response (GtkDialog *dialog,
|
|||||||
{
|
{
|
||||||
gchar *args[2] = { critical->program , NULL };
|
gchar *args[2] = { critical->program , NULL };
|
||||||
|
|
||||||
|
#ifndef G_OS_WIN32
|
||||||
if (critical->pid > 0)
|
if (critical->pid > 0)
|
||||||
kill (critical->pid, SIGINT);
|
kill ((pid_t ) critical->pid, SIGINT);
|
||||||
|
#endif
|
||||||
if (critical->program)
|
if (critical->program)
|
||||||
g_spawn_async (NULL, args, NULL, G_SPAWN_DEFAULT,
|
g_spawn_async (NULL, args, NULL, G_SPAWN_DEFAULT,
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
@ -250,7 +252,7 @@ gimp_critical_dialog_add (GtkWidget *dialog,
|
|||||||
const gchar *trace,
|
const gchar *trace,
|
||||||
gboolean is_fatal,
|
gboolean is_fatal,
|
||||||
const gchar *program,
|
const gchar *program,
|
||||||
pid_t pid)
|
gint pid)
|
||||||
{
|
{
|
||||||
GimpCriticalDialog *critical;
|
GimpCriticalDialog *critical;
|
||||||
GtkTextBuffer *buffer;
|
GtkTextBuffer *buffer;
|
||||||
|
@ -44,7 +44,7 @@ struct _GimpCriticalDialog
|
|||||||
GtkWidget *details;
|
GtkWidget *details;
|
||||||
|
|
||||||
gchar *program;
|
gchar *program;
|
||||||
pid_t pid;
|
gint pid;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GimpCriticalDialogClass
|
struct _GimpCriticalDialogClass
|
||||||
@ -61,7 +61,7 @@ void gimp_critical_dialog_add (GtkWidget *dialog,
|
|||||||
const gchar *trace,
|
const gchar *trace,
|
||||||
gboolean is_fatal,
|
gboolean is_fatal,
|
||||||
const gchar *program,
|
const gchar *program,
|
||||||
pid_t pid);
|
gint pid);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -7,24 +7,17 @@ libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
|
|||||||
if OS_WIN32
|
if OS_WIN32
|
||||||
|
|
||||||
bin_PROGRAMS = \
|
bin_PROGRAMS = \
|
||||||
gimptool-2.0 \
|
gimptool-2.0 \
|
||||||
gimp-debug-resume
|
gimpdebug-2.0 \
|
||||||
|
gimp-debug-resume
|
||||||
if !ENABLE_GIMP_CONSOLE
|
|
||||||
if HAVE_EXCHNDL
|
|
||||||
bin_PROGRAMS += gimpdebug-2.0
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
gimp_debug_resume_SOURCES = gimp-debug-resume.c
|
gimp_debug_resume_SOURCES = gimp-debug-resume.c
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
bin_PROGRAMS = gimptool-2.0
|
bin_PROGRAMS = \
|
||||||
|
gimptool-2.0 \
|
||||||
if !ENABLE_GIMP_CONSOLE
|
gimpdebug-2.0
|
||||||
bin_PROGRAMS += gimpdebug-2.0
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -44,12 +37,16 @@ gimpdebug_2_0_CPPFLAGS = \
|
|||||||
-I$(top_srcdir)/app \
|
-I$(top_srcdir)/app \
|
||||||
-I$(top_builddir)/app \
|
-I$(top_builddir)/app \
|
||||||
$(AM_CPPFLAGS) \
|
$(AM_CPPFLAGS) \
|
||||||
|
$(GIO_CFLAGS) \
|
||||||
$(GEGL_CFLAGS) \
|
$(GEGL_CFLAGS) \
|
||||||
$(GTK_CFLAGS)
|
$(GTK_CFLAGS) \
|
||||||
|
$(FONTCONFIG_CFLAGS)
|
||||||
|
|
||||||
gimpdebug_2_0_LDADD = \
|
gimpdebug_2_0_LDADD = \
|
||||||
|
$(GIO_LIBS) \
|
||||||
$(GEGL_LIBS) \
|
$(GEGL_LIBS) \
|
||||||
$(GTK_LIBS)
|
$(GTK_LIBS) \
|
||||||
|
$(FONTCONFIG_LIBS)
|
||||||
|
|
||||||
|
|
||||||
gimptool_2_0_SOURCES = gimptool.c
|
gimptool_2_0_SOURCES = gimptool.c
|
||||||
|
Reference in New Issue
Block a user