[libpeas] Prevent recurse complaints when printing unhit log hooks



commit e1f7ad9dd3f9c0eecf16e8a818c04b8083c47867
Author: Garrett Regier <garrettregier gmail com>
Date:   Sun Aug 28 00:04:05 2011 -0700

    Prevent recurse complaints when printing unhit log hooks

 tests/testing-util/testing-util.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/tests/testing-util/testing-util.c b/tests/testing-util/testing-util.c
index b5ea4c3..12c3ae0 100644
--- a/tests/testing-util/testing-util.c
+++ b/tests/testing-util/testing-util.c
@@ -255,12 +255,19 @@ testing_util_pop_log_hooks (void)
 
   if (unhit_hooks->len == 1)
     {
+      gchar *msg;
+
       hook = g_ptr_array_index (unhit_hooks, 0);
-      g_error ("Log hook was not triggered: '%s'", hook->pattern);
+      msg = g_strdup_printf ("Log hook was not triggered: '%s'",
+                             hook->pattern);
+
+      /* Use the default log handler directly to avoid recurse complaints */
+      g_log_default_handler (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, msg, NULL);
+      abort ();
     }
   else if (unhit_hooks->len > 1)
     {
-      /* Avoid our log handler */
+      /* Use the default log handler directly to avoid recurse complaints */
       g_log_default_handler (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR,
                              "Log hooks were not triggered:\n", NULL);
 



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