[gimp/wip/bug792787-debug-stacktrace-GUI] app, tools: various fixes for Win32 build.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/bug792787-debug-stacktrace-GUI] app, tools: various fixes for Win32 build.
- Date: Sun, 28 Jan 2018 03:10:39 +0000 (UTC)
commit 3d3cb38e3b5b7f0bf549f0960e3657099c089cf4
Author: Jehan <jehan girinstud io>
Date: Fri Jan 26 23:47:11 2018 +0100
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.
app/errors.c | 34 ++++++++++++++++++----------------
app/widgets/gimpcriticaldialog.c | 6 ++++--
app/widgets/gimpcriticaldialog.h | 4 ++--
tools/Makefile.am | 27 ++++++++++++---------------
4 files changed, 36 insertions(+), 35 deletions(-)
---
diff --git a/app/errors.c b/app/errors.c
index 1e2a12c..693a400 100644
--- a/app/errors.c
+++ b/app/errors.c
@@ -19,13 +19,7 @@
#define _GNU_SOURCE /* need the POSIX signal API */
-#include <signal.h>
-#include <stdarg.h>
-#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/wait.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -262,8 +256,9 @@ gimp_eek (const gchar *reason,
const gchar *message,
gboolean use_handler)
{
- GimpCoreConfig *config = the_errors_gimp->config;
+ GimpCoreConfig *config = the_errors_gimp->config;
gboolean generate_backtrace = FALSE;
+ gboolean eek_handled = FALSE;
/* 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
@@ -277,10 +272,13 @@ gimp_eek (const gchar *reason,
"generate-backtrace", &generate_backtrace,
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),
reason, message);
+#if ! defined (G_OS_WIN32) || defined (HAVE_EXCHNDL)
+
if (use_handler)
{
#ifndef GIMP_CONSOLE_COMPILATION
@@ -307,9 +305,12 @@ gimp_eek (const gchar *reason,
g_spawn_sync (NULL, args, NULL,
G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL | G_SPAWN_STDOUT_TO_DEV_NULL,
NULL, NULL, NULL, NULL, &exit_status, NULL);
+ eek_handled = TRUE;
}
- else
-#endif
+#endif /* !GIMP_CONSOLE_COMPILATION */
+
+#ifndef G_OS_WIN32
+ if (! eek_handled)
{
switch (stack_trace_mode)
{
@@ -345,15 +346,16 @@ gimp_eek (const gchar *reason,
break;
}
}
+#endif /* ! G_OS_WIN32 */
}
-#else
+#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. */
-
- MessageBox (NULL, g_strdup_printf ("%s: %s", reason, message),
- full_prog_name, MB_OK|MB_ICONERROR);
-
-#endif /* ! G_OS_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);
}
diff --git a/app/widgets/gimpcriticaldialog.c b/app/widgets/gimpcriticaldialog.c
index 7453e68..a046d2a 100644
--- a/app/widgets/gimpcriticaldialog.c
+++ b/app/widgets/gimpcriticaldialog.c
@@ -217,8 +217,10 @@ gimp_critical_dialog_response (GtkDialog *dialog,
{
gchar *args[2] = { critical->program , NULL };
+#ifndef G_OS_WIN32
if (critical->pid > 0)
- kill (critical->pid, SIGINT);
+ kill ((pid_t ) critical->pid, SIGINT);
+#endif
if (critical->program)
g_spawn_async (NULL, args, NULL, G_SPAWN_DEFAULT,
NULL, NULL, NULL, NULL);
@@ -250,7 +252,7 @@ gimp_critical_dialog_add (GtkWidget *dialog,
const gchar *trace,
gboolean is_fatal,
const gchar *program,
- pid_t pid)
+ gint pid)
{
GimpCriticalDialog *critical;
GtkTextBuffer *buffer;
diff --git a/app/widgets/gimpcriticaldialog.h b/app/widgets/gimpcriticaldialog.h
index 76a9581..ca4a84f 100644
--- a/app/widgets/gimpcriticaldialog.h
+++ b/app/widgets/gimpcriticaldialog.h
@@ -44,7 +44,7 @@ struct _GimpCriticalDialog
GtkWidget *details;
gchar *program;
- pid_t pid;
+ gint pid;
};
struct _GimpCriticalDialogClass
@@ -61,7 +61,7 @@ void gimp_critical_dialog_add (GtkWidget *dialog,
const gchar *trace,
gboolean is_fatal,
const gchar *program,
- pid_t pid);
+ gint pid);
G_END_DECLS
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 795b57d..ca1a62c 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -7,24 +7,17 @@ libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
if OS_WIN32
bin_PROGRAMS = \
- gimptool-2.0 \
- gimp-debug-resume
-
-if !ENABLE_GIMP_CONSOLE
-if HAVE_EXCHNDL
-bin_PROGRAMS += gimpdebug-2.0
-endif
-endif
+ gimptool-2.0 \
+ gimpdebug-2.0 \
+ gimp-debug-resume
gimp_debug_resume_SOURCES = gimp-debug-resume.c
else
-bin_PROGRAMS = gimptool-2.0
-
-if !ENABLE_GIMP_CONSOLE
-bin_PROGRAMS += gimpdebug-2.0
-endif
+bin_PROGRAMS = \
+ gimptool-2.0 \
+ gimpdebug-2.0
endif
@@ -44,12 +37,16 @@ gimpdebug_2_0_CPPFLAGS = \
-I$(top_srcdir)/app \
-I$(top_builddir)/app \
$(AM_CPPFLAGS) \
+ $(GIO_CFLAGS) \
$(GEGL_CFLAGS) \
- $(GTK_CFLAGS)
+ $(GTK_CFLAGS) \
+ $(FONTCONFIG_CFLAGS)
gimpdebug_2_0_LDADD = \
+ $(GIO_LIBS) \
$(GEGL_LIBS) \
- $(GTK_LIBS)
+ $(GTK_LIBS) \
+ $(FONTCONFIG_LIBS)
gimptool_2_0_SOURCES = gimptool.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]