diff src/debug.c @ 13926:756c3d7177d9

[gaim-migrate @ 16445] Fix a crash bug on some systems (mostly amd64) caused by using a va_list twice. My bad! Thanks to Kevin Stange and Vincent Ho for noticing this and suggesting the cause. Vincent's IRC handle reminds me of a Harvey Danger song. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 06 Jul 2006 09:21:57 +0000
parents e1e5462b7d81
children
line wrap: on
line diff
--- a/src/debug.c	Thu Jul 06 08:24:26 2006 +0000
+++ b/src/debug.c	Thu Jul 06 09:21:57 2006 +0000
@@ -46,14 +46,20 @@
 				 const char *format, va_list args)
 {
 	GaimDebugUiOps *ops;
+	char *arg_s = NULL;
 
 	g_return_if_fail(level != GAIM_DEBUG_ALL);
 	g_return_if_fail(format != NULL);
 
+	ops = gaim_debug_get_ui_ops();
+
+	if (!debug_enabled && ((ops == NULL) || (ops->print == NULL)))
+		return;
+
+	arg_s = g_strdup_vprintf(format, args);
+
 	if (debug_enabled) {
-		gchar *arg_s, *ts_s;
-
-		arg_s = g_strdup_vprintf(format, args);
+		gchar *ts_s;
 
 		if ((category != NULL) &&
 			(gaim_prefs_exists("/core/debug/timestamps")) &&
@@ -72,14 +78,13 @@
 		else
 			g_print("%s%s: %s", ts_s, category, arg_s);
 
-		g_free(arg_s);
 		g_free(ts_s);
 	}
 
-	ops = gaim_debug_get_ui_ops();
+	if (ops != NULL && ops->print != NULL)
+		ops->print(level, category, arg_s);
 
-	if (ops != NULL && ops->print != NULL)
-		ops->print(level, category, format, args);
+	g_free(arg_s);
 }
 
 void