Commit 5d200c2c authored by Jehan's avatar Jehan

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.
parent 34fe992f
......@@ -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);
......@@ -166,37 +164,23 @@ 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
{
......
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