[gimp] app: handle GEGL WARNING and CRITICAL with the new debugging GUI.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: handle GEGL WARNING and CRITICAL with the new debugging GUI.
- Date: Mon, 12 Feb 2018 03:00:27 +0000 (UTC)
commit 5d200c2c4baa5d8760de6abf618175b609d07d03
Author: Jehan <jehan girinstud io>
Date: Mon Feb 12 02:30:55 2018 +0100
app: handle GEGL WARNING and CRITICAL with the new debugging GUI.
It is not always very useful since GEGL makes heavy use of threads, and
therefore a backtrace of the main thread for an error on another thread
is mostly useless. But that's a start. I am still improving.
I was holding on non-GIMP messages until now because we don't have as
much control on them, and for some errors, they may be huge. For
instance, the bug told by Massimo in bug 792787, comment 22, generates
hundreds of thousands (and even millions for big enough polygons) of
errors. But I can now allow these to pass since previous commit when I
now only display a few errors, and then redirect remaining errors to
stderr.
Also get rid of gimp_third_party_message_log_func() and instead make
gimp_message_log_func() handle correcly non-GIMP messages by keeping
their domain.
app/errors.c | 48 ++++++++++++++++--------------------------------
1 files changed, 16 insertions(+), 32 deletions(-)
---
diff --git a/app/errors.c b/app/errors.c
index 3bf83cc..5649568 100644
--- a/app/errors.c
+++ b/app/errors.c
@@ -51,10 +51,6 @@ static gchar *backtrace_file = NULL;
/* local function prototypes */
-static void gimp_third_party_message_log_func (const gchar *log_domain,
- GLogLevelFlags flags,
- const gchar *message,
- gpointer data);
static void gimp_message_log_func (const gchar *log_domain,
GLogLevelFlags flags,
const gchar *message,
@@ -135,8 +131,10 @@ errors_init (Gimp *gimp,
gimp_message_log_func, gimp);
g_log_set_handler ("GEGL",
- G_LOG_LEVEL_MESSAGE,
- gimp_third_party_message_log_func, gimp);
+ G_LOG_LEVEL_WARNING |
+ G_LOG_LEVEL_MESSAGE |
+ G_LOG_LEVEL_CRITICAL,
+ gimp_message_log_func, gimp);
g_log_set_handler (NULL,
G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL,
gimp_error_log_func, gimp);
@@ -167,36 +165,22 @@ gimp_terminate (const gchar *message)
/* private functions */
static void
-gimp_third_party_message_log_func (const gchar *log_domain,
- GLogLevelFlags flags,
- const gchar *message,
- gpointer data)
-{
- Gimp *gimp = data;
-
- if (gimp)
- {
- /* Whereas all GIMP messages are processed under the same domain,
- * we need to keep the log domain information for third party
- * messages.
- */
- gimp_show_message (gimp, NULL, GIMP_MESSAGE_WARNING,
- log_domain, message);
- }
- else
- {
- g_printerr ("%s: %s\n\n", log_domain, message);
- }
-}
-
-static void
gimp_message_log_func (const gchar *log_domain,
GLogLevelFlags flags,
const gchar *message,
gpointer data)
{
- Gimp *gimp = data;
- GimpMessageSeverity severity = GIMP_MESSAGE_WARNING;
+ Gimp *gimp = data;
+ const gchar *msg_domain = NULL;
+ GimpMessageSeverity severity = GIMP_MESSAGE_WARNING;
+
+ /* All GIMP messages are processed under the same domain, but
+ * we need to keep the log domain information for third party
+ * messages.
+ */
+ if (! g_str_has_prefix (log_domain, "Gimp") &&
+ ! g_str_has_prefix (log_domain, "LibGimp"))
+ msg_domain = log_domain;
if (flags & (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING))
{
@@ -217,7 +201,7 @@ gimp_message_log_func (const gchar *log_domain,
if (gimp)
{
- gimp_show_message (gimp, NULL, severity, NULL, message);
+ gimp_show_message (gimp, NULL, severity, msg_domain, message);
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]