[gimp] app: add backtraces on warning messages in GIMP_UNSTABLE.



commit b8fa968b7975316e0319eacdb9e54799a06f721c
Author: Jehan <jehan girinstud io>
Date:   Sun Jan 28 17:20:11 2018 +0100

    app: add backtraces on warning messages in GIMP_UNSTABLE.

 app/errors.c                     |    9 +++++++--
 app/widgets/gimpcriticaldialog.c |   22 +++++++++++-----------
 2 files changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/app/errors.c b/app/errors.c
index d1b68de..bb9644c 100644
--- a/app/errors.c
+++ b/app/errors.c
@@ -131,6 +131,9 @@ errors_init (Gimp               *gimp,
 
   for (i = 0; i < G_N_ELEMENTS (log_domains); i++)
     g_log_set_handler (log_domains[i],
+#ifdef GIMP_UNSTABLE
+                       G_LOG_LEVEL_WARNING |
+#endif
                        G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_CRITICAL,
                        gimp_message_log_func, gimp);
 
@@ -206,9 +209,11 @@ gimp_message_log_func (const gchar    *log_domain,
                 "generate-backtrace", &generate_backtrace,
                 NULL);
 
-  if (generate_backtrace && (flags & G_LOG_LEVEL_CRITICAL))
+  if (generate_backtrace &&
+      (flags & (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING)))
     {
-      severity = GIMP_MESSAGE_ERROR;
+      severity = (flags & G_LOG_LEVEL_CRITICAL) ?
+                 GIMP_MESSAGE_ERROR : GIMP_MESSAGE_WARNING;
 
       if (n_traces < MAX_TRACES)
         {
diff --git a/app/widgets/gimpcriticaldialog.c b/app/widgets/gimpcriticaldialog.c
index c5f9edd..d451c2b 100644
--- a/app/widgets/gimpcriticaldialog.c
+++ b/app/widgets/gimpcriticaldialog.c
@@ -356,17 +356,17 @@ gimp_critical_dialog_new (const gchar *title)
 }
 
 void
-gimp_critical_dialog_add (GtkWidget  *dialog,
-                          const gchar         *message,
-                          const gchar         *trace,
-                          gboolean             is_fatal,
-                          const gchar         *program,
-                          gint                 pid)
+gimp_critical_dialog_add (GtkWidget   *dialog,
+                          const gchar *message,
+                          const gchar *trace,
+                          gboolean     is_fatal,
+                          const gchar *program,
+                          gint         pid)
 {
   GimpCriticalDialog *critical;
-  GtkTextBuffer *buffer;
-  GtkTextIter    end;
-  gchar         *text;
+  GtkTextBuffer      *buffer;
+  GtkTextIter         end;
+  gchar              *text;
 
   if (! GIMP_IS_CRITICAL_DIALOG (dialog) || ! message || ! trace)
     {
@@ -389,8 +389,8 @@ gimp_critical_dialog_add (GtkWidget  *dialog,
   else if (! gtk_label_get_text (GTK_LABEL (critical->label)) ||
            strlen (gtk_label_get_text (GTK_LABEL (critical->label))) == 0)
     {
-      /* First critical error. Let's just display it. */
-      text = g_strdup_printf (_("GIMP encountered a critical error: %s"),
+      /* First error. Let's just display it. */
+      text = g_strdup_printf (_("GIMP encountered an error: %s"),
                               message);
     }
   else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]