Re: PATCH: Re: Gtk-CRITICAL error



On Sun, 1 Aug 1999, Iain wrote:

[...]

> Here's a patch for gmessages.c in GLIB so that it will print out the program
> name everytime it prints a warning. I find it annoying whenever I return to
> a virtual terminal after closing X down to find 4 or 5 **Warning** Cannot
> disconnect signal handler 108465638 or some such warnings, without knowing
> where they've come from (I had originally thought GMC, turns out it'd the
> panel - thanks to the patch :). It's probably already available in a
> configuration option somewhere but that would have involved RTFM and I
> didn't, so I don't know.
> I've waffled enough, here's the patch
> Hope it's useful.
> Iain
> --- /usr/local/src/gnome/glib/gmessages.c Sat Jul 31 13:25:52 1999
> +++ /home/iain/gmessages.c Sat Jul 31 13:46:45 1999
> @@ -424,8 +424,10 @@
>    GWarningFunc   local_glib_warning_func;
>    GPrintFunc     local_glib_message_func;
> +  gchar *prgname;
> 
>    in_recursion = (log_level & G_LOG_FLAG_RECURSION) != 0;
>    is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
>    log_level &= G_LOG_LEVEL_MASK;
> +  prgname = g_get_prgname ();
> 
>    if (!message)
> @@ -461,4 +463,6 @@
>   {
>     write (fd, "\n", 1);
> +   write (fd, prgname, strlen (prgname));
> +   write (fd, ": ", 2);
[...]

g_get_prgname() can return NULL, this would then segfault upon warnings.

in general, there is no need to additionally prefix warnings, errors
messages, etc... with the program name.
through the log domains, we already feature specific compile time log
layers. if the panel or other applications want their own warnings
to appear prefixed, just define -DG_LOG_DOMAIN=\"PANEL\" upon their
compilation.


---
ciaoTJ



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