add new GDebugFlag for fatal_criticals handle G_DEBUG=fatal_criticals, to
authorMatthias Clasen <mclasen@redhat.com>
Fri, 4 Nov 2005 19:05:30 +0000 (19:05 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 4 Nov 2005 19:05:30 +0000 (19:05 +0000)
2005-11-04  Matthias Clasen  <mclasen@redhat.com>

        * glib/gdebug.h: add new GDebugFlag for fatal_criticals
        * glib/gmessages.c: (_g_debug_init): handle G_DEBUG=fatal_criticals,
        to help find critical warnings in applications.  (#320017,
        Vincent Untz)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
docs/reference/ChangeLog
docs/reference/glib/running.sgml
glib/gdebug.h
glib/gmessages.c

index 53fb72c..000c1ad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-11-04  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/gdebug.h: add new GDebugFlag for fatal_criticals
+       * glib/gmessages.c: (_g_debug_init): handle G_DEBUG=fatal_criticals,
+       to help find critical warnings in applications.  (#320017,
+       Vincent Untz)
+
 2005-11-02  Tor Lillqvist  <tml@novell.com>
 
        * glib/glib.symbols: Remove large amount of trailing whitespace
index 53fb72c..000c1ad 100644 (file)
@@ -1,3 +1,10 @@
+2005-11-04  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/gdebug.h: add new GDebugFlag for fatal_criticals
+       * glib/gmessages.c: (_g_debug_init): handle G_DEBUG=fatal_criticals,
+       to help find critical warnings in applications.  (#320017,
+       Vincent Untz)
+
 2005-11-02  Tor Lillqvist  <tml@novell.com>
 
        * glib/glib.symbols: Remove large amount of trailing whitespace
index 53fb72c..000c1ad 100644 (file)
@@ -1,3 +1,10 @@
+2005-11-04  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/gdebug.h: add new GDebugFlag for fatal_criticals
+       * glib/gmessages.c: (_g_debug_init): handle G_DEBUG=fatal_criticals,
+       to help find critical warnings in applications.  (#320017,
+       Vincent Untz)
+
 2005-11-02  Tor Lillqvist  <tml@novell.com>
 
        * glib/glib.symbols: Remove large amount of trailing whitespace
index 6a489f6..d4e5cf4 100644 (file)
@@ -1,3 +1,7 @@
+2005-11-04  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/running.sgml: Document fatal_criticals.
+
 2005-10-26  Matthias Clasen  <mclasen@redhat.com>
 
        * gobject/gobject-sections.txt: 
index 8cd4d58..f17d68c 100644 (file)
@@ -65,7 +65,16 @@ variables like <envar>LANG</envar>, <envar>PATH</envar> or <envar>HOME</envar>.
       <varlistentry>
         <term>fatal_warnings</term>
         <listitem><para>Causes GLib to abort the program at the first call
-           to <link linkend="g-warning">g_warning</link>(). This option is 
+           to <link linkend="g-warning">g_warning</link>() or
+          <link linkend="g-critical">g_critical</link>(). This option is 
+           special in that it doesn't require GLib to be configured with 
+           debugging support.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>fatal_criticals</term>
+        <listitem><para>Causes GLib to abort the program at the first call
+           to <link linkend="g-critical">g_critical</link>(). This option is 
            special in that it doesn't require GLib to be configured with 
            debugging support.</para>
         </listitem>
index 67a8af8..8e172b7 100644 (file)
@@ -30,7 +30,8 @@
 G_BEGIN_DECLS 
 
 typedef enum {
-  G_DEBUG_FATAL_WARNINGS = 1 << 0
+  G_DEBUG_FATAL_WARNINGS  = 1 << 0,
+  G_DEBUG_FATAL_CRITICALS = 1 << 1
 } GDebugFlag;
 
 
index 8f63b3e..38298bf 100644 (file)
@@ -1069,7 +1069,8 @@ _g_debug_init (void)
   if (val != NULL)
     {
       static const GDebugKey keys[] = {
-       {"fatal_warnings", G_DEBUG_FATAL_WARNINGS}
+       {"fatal_warnings", G_DEBUG_FATAL_WARNINGS},
+       {"fatal_criticals", G_DEBUG_FATAL_CRITICALS}
       };
       
       _g_debug_flags = g_parse_debug_string (val, keys, G_N_ELEMENTS (keys));
@@ -1083,6 +1084,15 @@ _g_debug_init (void)
       fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
       g_log_set_always_fatal (fatal_mask);
     }
+  
+  if (_g_debug_flags & G_DEBUG_FATAL_CRITICALS) 
+    {
+      GLogLevelFlags fatal_mask;
+      
+      fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
+      fatal_mask |= G_LOG_LEVEL_CRITICAL;
+      g_log_set_always_fatal (fatal_mask);
+    }
 }
 
 #define __G_MESSAGES_C__