[glib] gmessages: Simplify _g_log_abort() in gmessages.c a little



commit ae9e72ef612c0df3ad76b334b2483945ca495fad
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Tue Mar 15 12:28:37 2016 +0000

    gmessages: Simplify _g_log_abort() in gmessages.c a little
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744456

 glib/gmessages.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/glib/gmessages.c b/glib/gmessages.c
index 744aa66..d29563a 100644
--- a/glib/gmessages.c
+++ b/glib/gmessages.c
@@ -311,6 +311,8 @@ static void _g_log_abort (gboolean breakpoint);
 static void
 _g_log_abort (gboolean breakpoint)
 {
+  gboolean debugger_present;
+
   if (g_test_subprocess ())
     {
       /* If this is a test case subprocess then it probably caused
@@ -321,7 +323,14 @@ _g_log_abort (gboolean breakpoint)
       _exit (1);
     }
 
-  if (breakpoint)
+#ifdef G_OS_WIN32
+  debugger_present = IsDebuggerPresent ();
+#else
+  /* Assume GDB is attached. */
+  debugger_present = TRUE;
+#endif /* !G_OS_WIN32 */
+
+  if (debugger_present && breakpoint)
     G_BREAKPOINT ();
   else
     g_abort ();
@@ -1075,10 +1084,9 @@ g_logv (const gchar   *log_domain,
                   MessageBox (NULL, locale_msg, NULL,
                               MB_ICONERROR|MB_SETFOREGROUND);
                 }
-             _g_log_abort (IsDebuggerPresent () && !(test_level & G_LOG_FLAG_RECURSION));
-#else
-             _g_log_abort (!(test_level & G_LOG_FLAG_RECURSION));
 #endif /* !G_OS_WIN32 */
+
+              _g_log_abort (!(test_level & G_LOG_FLAG_RECURSION));
            }
          
          depth--;


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