[Telepathy-commits] [telepathy-haze/master] Only make libpurple's criticals non-fatal

Will Thompson will.thompson at collabora.co.uk
Wed Aug 27 08:22:44 PDT 2008


---
 src/main.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/main.c b/src/main.c
index 9c206b7..6546568 100644
--- a/src/main.c
+++ b/src/main.c
@@ -217,14 +217,22 @@ get_cm (void)
 {
     GLogLevelFlags fatal_mask;
 
-    /* libpurple throws critical errors all over the place because of
-     * g_return_val_if_fail().
-     * Particularly in MSN.
-     * I hate MSN.
+    /* libpurple has a tendency to throw critical errors from
+     * g_return_val_if_fail(), particularly in MSN code.  We really don't want
+     * haze to die in those cases, so we disable fatal criticals for libpurple.
+     *
+     * This is complicated by libpurple not correctly setting G_LOG_DOMAIN.
+     * This will be fixed in a future libpurple, but in the meantime haze sets
+     * G_LOG_DOMAIN="haze" for itself so that we can assume the NULL domain is
+     * libpurple.
      */
-    fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
+    fatal_mask = g_log_set_fatal_mask (NULL, G_LOG_FATAL_MASK);
     fatal_mask &= ~G_LOG_LEVEL_CRITICAL;
-    g_log_set_always_fatal (fatal_mask);
+    g_log_set_fatal_mask (NULL, fatal_mask);
+
+    fatal_mask = g_log_set_fatal_mask ("purple", G_LOG_FATAL_MASK);
+    fatal_mask &= ~G_LOG_LEVEL_CRITICAL;
+    g_log_set_fatal_mask ("purple", fatal_mask);
 
     return (TpBaseConnectionManager *) haze_connection_manager_get ();
 }
-- 
1.5.6.3




More information about the Telepathy-commits mailing list